package response

import (
	shareddto "wucher/internal/transport/http/dto/shared"
	"wucher/internal/transport/http/jsonapi"
)

type HelicopterFileResource struct {
	Type       string                             `json:"type" example:"helicopter_file"`
	ID         string                             `json:"id" example:"019d6773-ccca-71dd-b9c7-8e6f531deb90"`
	Attributes shareddto.HelicopterFileAttributes `json:"attributes"`
}

type HelicopterFileResponse struct {
	Data HelicopterFileResource `json:"data"`
}

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

type HelicopterFileCollectionHelicopter struct {
	ID   string `json:"id" example:"019d6771-5fb5-7337-837f-bc5ed85181a1"`
	Name string `json:"name" example:"AIRBUS H145"`
}

type HelicopterFileCollectionAttachment struct {
	ID          string `json:"id" example:"019d6771-6c8e-7a2d-a7b8-03bcb65fcb3e"`
	FileName    string `json:"file_name" example:"Before Flight Checklist.pdf"`
	DownloadURL string `json:"download_url" example:"https://s3.localhost.localstack.cloud:4566/wucher-file-dev/files/2026/04/05/policy.pdf?X-Amz-Signature=..."`
}

type HelicopterFileCollectionItem struct {
	HelicopterFileID  string                             `json:"helicopter_file_id" example:"019d6773-ccca-71dd-b9c7-8e6f531deb90"`
	Section           string                             `json:"section" example:"bfi"`
	Position          int                                `json:"position" example:"1"`
	IsMandatory       bool                               `json:"is_mandatory" example:"true"`
	IsTemplate        bool                               `json:"is_template" example:"true"`
	AttachmentPending bool                               `json:"attachment_pending" example:"true"`
	Attachment        HelicopterFileCollectionAttachment `json:"attachment"`
	CreatedAt         string                             `json:"created_at" example:"2026-04-14T08:00:00Z"`
	CreatedBy         string                             `json:"created_by" example:"019d61db-53c6-7280-87ec-e65f205c6d3b"`
	UpdatedAt         string                             `json:"updated_at" example:"2026-04-14T08:00:00Z"`
	UpdatedBy         string                             `json:"updated_by" example:"019d61db-53c6-7280-87ec-e65f205c6d3b"`
}

type HelicopterFileCollectionSections struct {
	Before  []HelicopterFileCollectionItem `json:"before"`
	Prepare []HelicopterFileCollectionItem `json:"prepare"`
	After   []HelicopterFileCollectionItem `json:"after"`
}

type HelicopterFileCollectionAttributes struct {
	Helicopter HelicopterFileCollectionHelicopter `json:"helicopter"`
	Files      HelicopterFileCollectionSections   `json:"files"`
}

type HelicopterFileCollectionResponse struct {
	Type       string                             `json:"type" example:"helicopter_file_collection"`
	Attributes HelicopterFileCollectionAttributes `json:"attributes"`
}

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

type HelicopterFileDeleteAttributes struct {
	Deleted bool `json:"deleted" example:"true"`
}

type HelicopterFileDeleteResource struct {
	Type       string                         `json:"type" example:"helicopter_file_delete"`
	Attributes HelicopterFileDeleteAttributes `json:"attributes"`
}

type HelicopterFileDeleteResponse struct {
	Data HelicopterFileDeleteResource `json:"data"`
}

type HelicopterFileUploadIntentResource struct {
	Type       string                                          `json:"type" example:"helicopter_file_upload_intent"`
	ID         string                                          `json:"id" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
	Attributes shareddto.FileManagerFileUploadIntentAttributes `json:"attributes"`
}

type HelicopterFileUploadIntentResponse struct {
	Data HelicopterFileUploadIntentResource `json:"data"`
}

type HelicopterFileBulkError struct {
	Status    int    `json:"status" example:"422"`
	Code      string `json:"code,omitempty" example:"HELICOPTER_FILE_INVALID_PAYLOAD"`
	ErrorCode string `json:"error_code,omitempty" example:"4220318"`
	Title     string `json:"title" example:"Validation error"`
	Detail    string `json:"detail" example:"helicopter_id is invalid UUID"`
}

type HelicopterFileUploadIntentBulkItem struct {
	Index    int                                 `json:"index" example:"0"`
	Success  bool                                `json:"success" example:"true"`
	Resource *HelicopterFileUploadIntentResource `json:"resource,omitempty"`
	Error    *HelicopterFileBulkError            `json:"error,omitempty"`
}

type HelicopterFileUploadIntentBulkResponse struct {
	Data []HelicopterFileUploadIntentBulkItem `json:"data"`
	Meta struct {
		Total          int  `json:"total" example:"3"`
		Success        int  `json:"success" example:"2"`
		Failed         int  `json:"failed" example:"1"`
		PartialSuccess bool `json:"partial_success" example:"true"`
	} `json:"meta"`
}

type HelicopterFileCreateBulkItem struct {
	Index    int                      `json:"index" example:"0"`
	Success  bool                     `json:"success" example:"true"`
	Resource *jsonapi.Resource        `json:"resource,omitempty"`
	Error    *HelicopterFileBulkError `json:"error,omitempty"`
}

type HelicopterFileCreateBulkResponse struct {
	Data []HelicopterFileCreateBulkItem `json:"data"`
	Meta struct {
		Total          int  `json:"total" example:"3"`
		Success        int  `json:"success" example:"2"`
		Failed         int  `json:"failed" example:"1"`
		PartialSuccess bool `json:"partial_success" example:"true"`
	} `json:"meta"`
}

type HelicopterFileUpdateBulkItem struct {
	Index    int                      `json:"index" example:"0"`
	Success  bool                     `json:"success" example:"true"`
	Resource *jsonapi.Resource        `json:"resource,omitempty"`
	Error    *HelicopterFileBulkError `json:"error,omitempty"`
}

type HelicopterFileUpdateBulkResponse struct {
	Data []HelicopterFileUpdateBulkItem `json:"data"`
	Meta struct {
		Total          int  `json:"total" example:"3"`
		Success        int  `json:"success" example:"2"`
		Failed         int  `json:"failed" example:"1"`
		PartialSuccess bool `json:"partial_success" example:"true"`
	} `json:"meta"`
}

type HelicopterFileCreatedSSEPayload struct {
	HelicopterID      string `json:"helicopter_id" example:"019d6771-5fb5-7337-837f-bc5ed85181a1"`
	HelicopterFileID  string `json:"helicopter_file_id" example:"019d6773-ccca-71dd-b9c7-8e6f531deb90"`
	FileID            string `json:"file_id" example:"019d6773-ccca-71dd-b9c7-8e6f531deb90"`
	Section           string `json:"section" example:"fpwb"`
	Position          int    `json:"position" example:"1"`
	IsMandatory       bool   `json:"is_mandatory" example:"true"`
	AttachmentPending bool   `json:"attachment_pending" example:"true"`
	Name              string `json:"name" example:"Before Flight Checklist.pdf"`
	MimeType          string `json:"mime_type,omitempty" example:"application/pdf"`
	UpdatedAt         string `json:"updated_at" example:"2026-07-01T06:00:00Z"`
}
