package entities

import (
	"time"

	"gorm.io/gorm"
)

type ProductWarehouse struct {
	Id          uint           `gorm:"primaryKey;autoIncrement"`
	ProductId   uint           `gorm:"not null"`
	WarehouseId uint           `gorm:"not null"`
	Quantity    float64        `gorm:"default:0"`
	CreatedAt   time.Time      `gorm:"autoCreateTime"`
	UpdatedAt   time.Time      `gorm:"autoUpdateTime"`
	CreatedBy   uint           `gorm:"not null"`
	DeletedAt   gorm.DeletedAt `json:"-" gorm:"index"`

	// Relations
	Product     Product   `gorm:"foreignKey:ProductId;references:Id"`
	Warehouse   Warehouse `gorm:"foreignKey:WarehouseId;references:Id"`
	CreatedUser User      `gorm:"foreignKey:CreatedBy;references:Id"`
}
