package validation

type SupplierPrice struct {
	SupplierID uint    `json:"supplier_id" validate:"required,gt=0"`
	Price      float64 `json:"price" validate:"required,gte=0"`
}

type Create struct {
	Name              string          `json:"name" validate:"required_strict,min=3,max=50"`
	Brand             string          `json:"brand" validate:"required_strict,min=2,max=50"`
	Sku               *string         `json:"sku,omitempty" validate:"omitempty,max=100"`
	UomID             uint            `json:"uom_id" validate:"required,gt=0"`
	ProductCategoryID uint            `json:"product_category_id" validate:"required,gt=0"`
	ProductPrice      float64         `json:"product_price" validate:"required"`
	SellingPrice      *float64        `json:"selling_price,omitempty" validate:"omitempty"`
	Tax               *float64        `json:"tax,omitempty" validate:"omitempty"`
	ExpiryPeriod      *int            `json:"expiry_period,omitempty" validate:"omitempty,gt=0"`
	Suppliers         []SupplierPrice `json:"suppliers,omitempty" validate:"omitempty,dive"`
	Flag              *string         `json:"flag,omitempty" validate:"omitempty,max=50"`
	SubFlag           *string         `json:"sub_flag,omitempty" validate:"omitempty,max=50"`
	SubFlags          []string        `json:"sub_flags,omitempty" validate:"omitempty,dive,max=50"`
	Flags             []string        `json:"flags,omitempty" validate:"omitempty,dive"`
}

type Update struct {
	Name              *string          `json:"name,omitempty" validate:"omitempty,min=3"`
	Brand             *string          `json:"brand,omitempty" validate:"omitempty,min=2"`
	Sku               *string          `json:"sku,omitempty" validate:"omitempty"`
	UomID             *uint            `json:"uom_id,omitempty" validate:"omitempty,gt=0"`
	ProductCategoryID *uint            `json:"product_category_id,omitempty" validate:"omitempty,gt=0"`
	ProductPrice      *float64         `json:"product_price,omitempty" validate:"omitempty"`
	SellingPrice      *float64         `json:"selling_price,omitempty" validate:"omitempty"`
	Tax               *float64         `json:"tax,omitempty" validate:"omitempty"`
	ExpiryPeriod      *int             `json:"expiry_period,omitempty" validate:"omitempty,gt=0"`
	Suppliers         *[]SupplierPrice `json:"suppliers,omitempty" validate:"omitempty,dive"`
	Flag              *string          `json:"flag,omitempty" validate:"omitempty,max=50"`
	SubFlag           *string          `json:"sub_flag,omitempty" validate:"omitempty,max=50"`
	SubFlags          *[]string        `json:"sub_flags,omitempty" validate:"omitempty,dive,max=50"`
	Flags             *[]string        `json:"flags,omitempty" validate:"omitempty,dive"`
}

type Query struct {
	Page              int    `query:"page" validate:"omitempty,number,min=1"`
	Limit             int    `query:"limit" validate:"omitempty,number,min=1"`
	Search            string `query:"search" validate:"omitempty,max=50"`
	ProductCategoryID int    `query:"product_category_id" validate:"omitempty,number,min=1"`
	IsDepletion       *bool  `query:"is_depletion" validate:"omitempty"`
	IncludeAll        *bool  `query:"include_all" validate:"omitempty"`
}
