package response

import shareddto "wucher/internal/transport/http/dto/shared"

// JSON:API Helicopter response DTOs

type HelicopterAttributes struct {
	Designation string                    `json:"designation" example:"OE-XHZ"`
	Identifier  string                    `json:"identifier" example:"ABC-0001"`
	Type        string                    `json:"type" example:"EC-135"`
	SortKey     *int                      `json:"sortkey" example:"10"`
	Engine1     string                    `json:"engine_1,omitempty" example:"TM"`
	Engine2     string                    `json:"engine_2,omitempty" example:"TM"`
	Consumption float64                   `json:"consumption_lt_min" example:"4.1"`
	NR1         bool                      `json:"nr1" example:"true"`
	NR2         bool                      `json:"nr2" example:"true"`
	LH          bool                      `json:"lh" example:"true"`
	RH          bool                      `json:"rh" example:"true"`
	MGB         bool                      `json:"mgb" example:"true"`
	IGB         bool                      `json:"igb" example:"false"`
	TGB         bool                      `json:"tgb" example:"true"`
	UTCOffset   int                       `json:"utc_offset" example:"-1"`
	Foto        *shareddto.HelicopterFoto `json:"foto,omitempty"`
	Dry         bool                      `json:"dry" example:"false"`
	AOG         bool                      `json:"aog" example:"false"`
	IsInUse     bool                      `json:"is_in_use" example:"false"`
	// Status is the operational status of the helicopter (read-time derived).
	// Values: "available", "booked", "aog", "mcf". Precedence: mcf > aog > booked > available.
	// "booked" = active flight assignment; "aog" = air_on_ground flag OR an open complaint
	// grounding it (non-MEL, or MEL past its grace deadline); "mcf" = a pending maintenance
	// check flight (MCF created, not yet passed).
	Status              string                                   `json:"status" example:"available" enums:"available,booked,aog,mcf"`
	AOGReason           string                                   `json:"aog_reason,omitempty" example:"Main rotor gearbox fault"`
	Note                string                                   `json:"note,omitempty" example:"Primary HEMS helicopter"`
	IsActive            bool                                     `json:"is_active" example:"true"`
	CreatedBy           *shareddto.HelicopterAuditUser           `json:"created_by,omitempty"`
	CreatedAt           string                                   `json:"created_at,omitempty" example:"2026-03-12T03:04:05Z"`
	UpdatedBy           *shareddto.HelicopterAuditUser           `json:"updated_by,omitempty"`
	UpdatedAt           string                                   `json:"updated_at,omitempty" example:"2026-03-12T03:04:05Z"`
	LastDailyInspection *shareddto.HelicopterLastDailyInspection `json:"last_daily_inspection"`
	// MaintenanceSchedules mirrors the helicopter's latest fleet status. It
	// always lists every inspection type; entries without data are empty.
	MaintenanceSchedules []shareddto.MaintenanceScheduleAttributes `json:"maintenance_schedules"`
}

type HelicopterResource struct {
	Type       string               `json:"type" example:"helicopter"`
	ID         string               `json:"id" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
	Attributes HelicopterAttributes `json:"attributes"`
}

type HelicopterResponse struct {
	Data HelicopterResource `json:"data"`
}

type HelicopterListResponse struct {
	Data []HelicopterResource `json:"data"`
	Meta struct {
		PageNumber int   `json:"page_number" example:"1"`
		PageSize   int   `json:"page_size" example:"20"`
		Total      int64 `json:"total" example:"120"`
	} `json:"meta"`
}

type HelicopterDataTableResponse struct {
	Data []HelicopterResource `json:"data"`
	Meta struct {
		Draw            int   `json:"draw" example:"1"`
		RecordsTotal    int64 `json:"records_total" example:"120"`
		RecordsFiltered int64 `json:"records_filtered" example:"12"`
	} `json:"meta"`
}

type HelicopterNextReportNumberAttributes struct {
	Identifier   string `json:"identifier" example:"ABC"`
	Sequence     int    `json:"sequence" example:"1"`
	ReportNumber string `json:"report_number" example:"ABC-0001"`
}

type HelicopterNextReportNumberResource struct {
	Type       string                               `json:"type" example:"helicopter_report_number"`
	ID         string                               `json:"id" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
	Attributes HelicopterNextReportNumberAttributes `json:"attributes"`
}

type HelicopterNextReportNumberResponse struct {
	Data HelicopterNextReportNumberResource `json:"data"`
}
