package entities

import (
	"time"

	"gorm.io/gorm"
)

type Warehouse struct {
	Id         uint   `gorm:"primaryKey"`
	Name       string `gorm:"type:varchar(50);not null"`
	Type       string `gorm:"not null"`
	AreaId     uint   `gorm:"not null"`
	LocationId *uint
	KandangId  *uint
	CreatedBy  uint           `gorm:"not null"`
	CreatedAt  time.Time      `gorm:"autoCreateTime"`
	UpdatedAt  time.Time      `gorm:"autoUpdateTime"`
	DeletedAt  gorm.DeletedAt `gorm:"index" json:"-"`

	CreatedUser User      `gorm:"foreignKey:CreatedBy;references:Id"`
	Area        Area      `gorm:"foreignKey:AreaId;references:Id"`
	Location    *Location `gorm:"foreignKey:LocationId;references:Id"`
	Kandang     *Kandang  `gorm:"foreignKey:KandangId;references:Id"`
}
