package entities

import (
	"time"

	"github.com/google/uuid"
)

type Unit struct {
	ID             uuid.UUID  `gorm:"type:uuid;primary_key;default:gen_random_uuid()" json:"id"`
	OrganizationID uuid.UUID  `gorm:"type:uuid;not null;index" json:"organization_id"`
	OutletID       *uuid.UUID `gorm:"type:uuid;index" json:"outlet_id"`
	Name           string     `gorm:"not null;size:255" json:"name"`
	Abbreviation   *string    `gorm:"size:50" json:"abbreviation"`
	IsActive       bool       `gorm:"default:true" json:"is_active"`
	DeletedAt      *time.Time `gorm:"index" json:"deleted_at,omitempty"`
	CreatedAt      time.Time  `gorm:"autoCreateTime" json:"created_at"`
	UpdatedAt      time.Time  `gorm:"autoUpdateTime" json:"updated_at"`
}

func (Unit) TableName() string {
	return "units"
}
