package validation

type SourceKandangDetail struct {
	ProjectFlockKandangId uint    `json:"project_flock_kandang_id" validate:"required"`
	Quantity              float64 `json:"quantity"`
}

type TargetKandangDetail struct {
	ProjectFlockKandangId uint    `json:"project_flock_kandang_id" validate:"required"`
	Quantity              float64 `json:"quantity"`
}

type Create struct {
	TransferDate         string                `json:"transfer_date" validate:"required,datetime=2006-01-02"`
	SourceProjectFlockId uint                  `json:"source_project_flock_id" validate:"required"`
	TargetProjectFlockId uint                  `json:"target_project_flock_id" validate:"required"`
	SourceKandangs       []SourceKandangDetail `json:"source_kandangs" validate:"required,min=1,max=1,dive,required"`
	TargetKandangs       []TargetKandangDetail `json:"target_kandangs" validate:"required,min=1,dive,required"`
	Reason               string                `json:"reason" validate:"omitempty,max=1000"`
}

type Update struct {
	TransferDate         string                `json:"transfer_date" validate:"required,datetime=2006-01-02"`
	SourceProjectFlockId uint                  `json:"source_project_flock_id" validate:"required"`
	TargetProjectFlockId uint                  `json:"target_project_flock_id" validate:"required"`
	SourceKandangs       []SourceKandangDetail `json:"source_kandangs" validate:"required,min=1,max=1,dive,required"`
	TargetKandangs       []TargetKandangDetail `json:"target_kandangs" validate:"required,min=1,dive,required"`
	Reason               string                `json:"reason" validate:"omitempty,max=1000"`
}

type Query struct {
	Page             int      `query:"page" validate:"omitempty,number,min=1,gt=0"`
	Limit            int      `query:"limit" validate:"omitempty,number,min=1,gt=0"`
	Search           string   `query:"search" validate:"omitempty"`
	StartDate        string   `query:"start_date" validate:"omitempty"`
	EndDate          string   `query:"end_date" validate:"omitempty"`
	FlockSource      []uint   `query:"flock_source" validate:"omitempty"`
	FlockDestination []uint   `query:"flock_destination" validate:"omitempty"`
	Status           []string `query:"status" validate:"omitempty"`
}

type Approve struct {
	Action        string  `json:"action" validate:"required_strict"`
	ApprovableIds []uint  `json:"approvable_ids" validate:"required_strict,min=1,dive,gt=0"`
	Notes         *string `json:"notes,omitempty" validate:"omitempty,max=500"`
}
