package validation

import (
	"mime/multipart"
)

type Create struct {
	Date                string `json:"date" validate:"required"`
	KandangId           uint   `json:"kandang_id" validate:"required"`
	Category            string `json:"category" validate:"required"`
	Status              string `json:"status" validate:"required"`
	EmptyKandang        bool   `json:"empty_kandang"`
	EmptyKandangEndDate string `json:"empty_kandang_end_date"`
}

type Update struct {
	Status             string                  `form:"status" json:"status" validate:"required"`
	RejectReason       *string                 `form:"reject_reason" json:"reject_reason"`
	Documents          []*multipart.FileHeader `form:"documents" json:"documents" validate:"omitempty,dive"`
	DeletedDocumentIDs *string                 `form:"deleted_document_ids" json:"deleted_document_ids"`
}

type BulkStatusUpdate struct {
	IDs          string  `form:"ids" json:"ids" validate:"required_strict"`
	Status       string  `form:"status" json:"status" validate:"required,oneof=APPROVED REJECTED"`
	RejectReason *string `form:"reject_reason" json:"reject_reason"`
}

type Query struct {
	Page      int    `query:"page" validate:"omitempty,number,min=1,gt=0"`
	Limit     int    `query:"limit" validate:"omitempty,number,min=1,max=100,gt=0"`
	Search    string `query:"search" validate:"omitempty,max=50"`
	DateFrom  string `query:"date_from" validate:"omitempty"`
	DateTo    string `query:"date_to" validate:"omitempty"`
	Status    string `query:"status" validate:"omitempty"`
	KandangID *uint  `query:"kandang_id" validate:"omitempty"`
}

type AssignPhases struct {
	PhaseIDs string `json:"phase_ids" validate:"omitempty"`
}

type AssignTask struct {
	EmployeeIDs string `json:"employee_ids" validate:"required"`
}

type UpdateAssignment struct {
	TaskID     uint    `json:"task_id" validate:"required"`
	EmployeeID uint    `json:"employee_id" validate:"required"`
	Checked    *bool   `json:"checked,omitempty"`
	Note       *string `json:"note,omitempty"`
}

type SummaryQuery struct {
	DateFrom  string `query:"date_from" validate:"required"`
	DateTo    string `query:"date_to" validate:"required"`
	Category  string `query:"category" validate:"omitempty"`
	KandangID *uint  `query:"kandang_id" validate:"omitempty"`
}

type ReportQuery struct {
	Page       int   `query:"page" validate:"required,number,min=1,gt=0"`
	Limit      int   `query:"limit" validate:"required,number,min=1,gt=0"`
	Month      int   `query:"bulan" validate:"required,number,min=1,max=12"`
	Year       int   `query:"tahun" validate:"required,number,min=1900"`
	AreaID     *uint `query:"area_id" validate:"omitempty"`
	LocationID *uint `query:"location_id" validate:"omitempty"`
	KandangID  *uint `query:"kandang_id" validate:"omitempty"`
	EmployeeID *uint `query:"employee_id" validate:"omitempty"`
	PhaseID    *uint `query:"phase_id" validate:"omitempty"`
}
