Files
fm_be/internal/transport/http/dto/request/complaint_request.go
2026-07-16 22:16:45 +07:00

83 lines
4.5 KiB
Go

package request
type ComplaintCreateAttributes struct {
// HelicopterID — the helicopter this complaint is filed against. REQUIRED.
HelicopterID string `json:"helicopter_id" validate:"required,uuid" example:"019d6771-5fb5-7337-837f-bc5ed85181a1"`
// FlightID — the flight/report this complaint was filed in (attribution). OPTIONAL;
// open-defect tracking stays per-helicopter so defects carry forward across flights.
FlightID string `json:"flight_id,omitempty" validate:"omitempty,uuid" example:"019d6774-98e8-7fba-9ef4-3795c0da8a13"`
// Description — the defect description. REQUIRED.
Description string `json:"description" validate:"required" example:"Engine 2 N2 vibration intermittent during cruise above 110 KIAS"`
// MELSeverity — MEL (Minimum Equipment List) classification. OPTIONAL at creation:
// omit it to file the complaint as "pending_mel" and classify later. It MUST be
// classified (via update) before recording action taken. A pending complaint does
// NOT ground the aircraft — grounding starts at classification. Values: 0 = NON-MEL
// (grounds immediately), 1 = A (grace 1 day), 2 = B (3 days), 3 = C (10 days), 4 = D (120 days).
MELSeverity *int8 `json:"mel_severity,omitempty" validate:"omitempty,oneof=0 1 2 3 4" enums:"0,1,2,3,4" example:"2"`
// AircraftHoursAtReport — OPTIONAL airframe hours recorded when the defect was reported.
AircraftHoursAtReport *string `json:"aircraft_hours_at_report,omitempty" example:"1245.3"`
// NSR is no longer set here — it is its own flow: POST /complaints/nsr/sign/{id}.
}
type ComplaintCreateData struct {
Type string `json:"type" validate:"required,oneof=complaint_create complaint" example:"complaint_create"`
Attributes ComplaintCreateAttributes `json:"attributes" validate:"required"`
}
type ComplaintCreateRequest struct {
Data ComplaintCreateData `json:"data" validate:"required"`
}
type ComplaintUpdateAttributes struct {
// Description — defect description.
Description *string `json:"description,omitempty" example:"Engine 2 vibration confirmed"`
// MELSeverity — MEL classification. 0 = NON-MEL (immediate AOG), 1 = A (1 day),
// 2 = B (3 days), 3 = C (10 days), 4 = D (120 days). AOG after grace passes.
MELSeverity *int8 `json:"mel_severity,omitempty" validate:"omitempty,oneof=0 1 2 3 4" enums:"0,1,2,3,4" example:"2"`
// AircraftHoursAtReport — airframe hours at report time.
AircraftHoursAtReport *string `json:"aircraft_hours_at_report,omitempty" example:"1245.3"`
// NSR is no longer set here — it is its own flow: POST /complaints/nsr/sign/{id}.
}
// ComplaintNSRSignAttributes carries the (optional) justification for a Non-Safety
// Release decision. NSR is signed via its own endpoint, separate from complaint update.
type ComplaintNSRSignAttributes struct {
// NSRReason — OPTIONAL free-text justification for the NSR (MEL deferral) decision.
NSRReason *string `json:"nsr_reason,omitempty" example:"Released under MEL A, defect deferred"`
}
type ComplaintNSRSignData struct {
Type string `json:"type" validate:"omitempty,oneof=complaint_nsr_sign complaint_nsr" example:"complaint_nsr_sign"`
Attributes ComplaintNSRSignAttributes `json:"attributes"`
}
type ComplaintNSRSignRequest struct {
Data ComplaintNSRSignData `json:"data"`
}
type ComplaintUpdateData struct {
Type string `json:"type" validate:"required,oneof=complaint_update complaint" example:"complaint_update"`
ID string `json:"id" validate:"required" example:"019d6771-5fb5-7337-837f-bc5ed85181a1"`
Attributes ComplaintUpdateAttributes `json:"attributes" validate:"required"`
}
type ComplaintUpdateRequest struct {
Data ComplaintUpdateData `json:"data" validate:"required"`
}
type ComplaintActionTakenAttributes struct {
// ActionTaken — corrective action text. Required when recording (create); on update an
// empty value clears it (allowed only while the action has not been signed off).
ActionTaken string `json:"action_taken" example:"Tightened engine mount and rechecked torque"`
AircraftHoursAtFix *string `json:"aircraft_hours_at_fix,omitempty" example:"1250.1"`
}
type ComplaintActionTakenData struct {
Type string `json:"type" validate:"required,oneof=complaint_action_taken complaint" example:"complaint_action_taken"`
Attributes ComplaintActionTakenAttributes `json:"attributes" validate:"required"`
}
type ComplaintActionTakenRequest struct {
Data ComplaintActionTakenData `json:"data" validate:"required"`
}