package dto

// JSON:API Hospital DTOs

type HospitalAttributes struct {
	Name           string `json:"name" example:"RSUD Kota"`
	SortKey        *int   `json:"sortkey" example:"1"`
	Address        string `json:"address,omitempty" example:"Jl. Merdeka No. 10"`
	LandlineNumber string `json:"landline_number,omitempty" example:"0211234567"`
	MobileNumber   string `json:"mobile_number,omitempty" example:"08123456789"`
	Email          string `json:"email,omitempty" example:"info@hospital.local"`
	Note           string `json:"note,omitempty" example:"Nearest trauma center"`
	IsActive       bool   `json:"is_active" example:"true"`
	CreatedAt      string `json:"created_at,omitempty" example:"2026-03-12T03:04:05Z"`
	CreatedBy      string `json:"created_by,omitempty" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
	UpdatedAt      string `json:"updated_at,omitempty" example:"2026-03-12T03:04:05Z"`
	UpdatedBy      string `json:"updated_by,omitempty" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
	DeletedAt      string `json:"deleted_at,omitempty" example:"2026-03-12T03:04:05Z"`
	DeletedBy      string `json:"deleted_by,omitempty" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
}

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

type HospitalResponse struct {
	Data HospitalResource `json:"data"`
}

type HospitalListResponse struct {
	Data []HospitalResource `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 HospitalDataTableResponse struct {
	Data []HospitalResource `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 HospitalCreateAttributes struct {
	Name           string  `json:"name" validate:"required" example:"RSUD Kota"`
	SortKey        *int    `json:"sortkey" example:"1"`
	Address        *string `json:"address,omitempty" example:"Jl. Merdeka No. 10"`
	LandlineNumber *string `json:"landline_number,omitempty" example:"0211234567"`
	MobileNumber   *string `json:"mobile_number,omitempty" example:"08123456789"`
	Email          *string `json:"email,omitempty" example:"info@hospital.local"`
	Note           *string `json:"note,omitempty" example:"Nearest trauma center"`
	IsActive       *bool   `json:"is_active,omitempty" example:"true"`
}

type HospitalCreateData struct {
	Type       string                   `json:"type" validate:"required,oneof=hospital_create hospital" example:"hospital_create"`
	Attributes HospitalCreateAttributes `json:"attributes" validate:"required"`
}

type HospitalCreateRequest struct {
	Data HospitalCreateData `json:"data" validate:"required"`
}

type HospitalUpdateAttributes struct {
	Name           *string `json:"name,omitempty" example:"RSUD Kota"`
	SortKey        NullInt `json:"sortkey,omitempty" swaggertype:"integer" example:"1"`
	Address        *string `json:"address,omitempty" example:"Jl. Merdeka No. 10"`
	LandlineNumber *string `json:"landline_number,omitempty" example:"0211234567"`
	MobileNumber   *string `json:"mobile_number,omitempty" example:"08123456789"`
	Email          *string `json:"email,omitempty" example:"info@hospital.local"`
	Note           *string `json:"note,omitempty" example:"Nearest trauma center"`
	IsActive       *bool   `json:"is_active,omitempty" example:"true"`
}

type HospitalUpdateData struct {
	Type       string                   `json:"type" validate:"required,oneof=hospital_update hospital" example:"hospital_update"`
	ID         string                   `json:"id" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
	Attributes HospitalUpdateAttributes `json:"attributes" validate:"required"`
}

type HospitalUpdateRequest struct {
	Data HospitalUpdateData `json:"data" validate:"required"`
}
