package entities

import (
	"time"

	"gorm.io/gorm"
)

type LayingTransferSource struct {
	Id                          uint           `gorm:"primaryKey"`
	LayingTransferId            uint           `gorm:"index;not null"`
	SourceProjectFlockKandangId uint           `gorm:"not null"`
	ProductWarehouseId          *uint          `gorm:""`
	RequestedQty                float64        `gorm:"type:numeric(15,3);default:0;not null"` // Quantity requested by user
	UsageQty                    float64        `gorm:"type:numeric(15,3);default:0;not null"`        // FIFO USABLE field
	PendingUsageQty             float64        `gorm:"type:numeric(15,3);default:0;not null"`        // FIFO USABLE field
	Note                        string         `gorm:"type:text"`
	CreatedAt                   time.Time      `gorm:"autoCreateTime"`
	UpdatedAt                   time.Time      `gorm:"autoUpdateTime"`
	DeletedAt                   gorm.DeletedAt `gorm:"index"`

	LayingTransfer            *LayingTransfer      `gorm:"foreignKey:LayingTransferId;references:Id"`
	SourceProjectFlockKandang *ProjectFlockKandang `gorm:"foreignKey:SourceProjectFlockKandangId;references:Id"`
	ProductWarehouse          *ProductWarehouse    `gorm:"foreignKey:ProductWarehouseId;references:Id"`
}
