package entities

import (
	"encoding/json"
	"time"
)

type ProjectFlockKandangUniformity struct {
	Id                    uint            `gorm:"primaryKey"`
	Uniformity            float64         `gorm:"type:numeric(15,3)"`
	Week                  int             `gorm:"not null"`
	Cv                    float64         `gorm:"type:numeric(15,3)"`
	ChickQtyOfWeight      float64         `gorm:"type:numeric(15,3)"`
	MeanUp                float64         `gorm:"type:numeric(15,3)"`
	MeanDown              float64         `gorm:"type:numeric(15,3)"`
	ProjectFlockKandangId uint            `gorm:"not null"`
	UniformQty            float64         `gorm:"type:numeric(15,3)"`
	NotUniformQty         float64         `gorm:"type:numeric(15,3)"`
	ChartData             json.RawMessage `gorm:"type:jsonb"`
	UniformDate           *time.Time      `gorm:"type:timestamptz"`
	CreatedBy             uint            `gorm:"not null"`

	ProjectFlockKandang ProjectFlockKandang `gorm:"foreignKey:ProjectFlockKandangId;references:Id"`
	CreatedUser         User                `gorm:"foreignKey:CreatedBy;references:Id"`
	LatestApproval      *Approval           `gorm:"-" json:"-"`
}

func (ProjectFlockKandangUniformity) TableName() string {
	return "project_flock_kandang_uniformity"
}
