package models

import (
	"time"

	"github.com/google/uuid"
)

type Unit struct {
	ID             uuid.UUID  `json:"id"`
	OrganizationID uuid.UUID  `json:"organization_id"`
	OutletID       *uuid.UUID `json:"outlet_id"`
	Name           string     `json:"name"`
	Abbreviation   *string    `json:"abbreviation"`
	IsActive       bool       `json:"is_active"`
	DeletedAt      *time.Time `json:"deleted_at,omitempty"`
	CreatedAt      time.Time  `json:"created_at"`
	UpdatedAt      time.Time  `json:"updated_at"`
}

type CreateUnitRequest struct {
	OrganizationID uuid.UUID  `json:"organization_id"`
	OutletID       *uuid.UUID `json:"outlet_id"`
	Name           string     `json:"name" validate:"required,min=1,max=50"`
	Abbreviation   *string    `json:"abbreviation" validate:"omitempty,max=10"`
	IsActive       bool       `json:"is_active"`
}

type UpdateUnitRequest struct {
	OutletID     *uuid.UUID `json:"outlet_id"`
	Name         string     `json:"name" validate:"required,min=1,max=50"`
	Abbreviation *string    `json:"abbreviation" validate:"omitempty,max=10"`
	IsActive     bool       `json:"is_active"`
}

type UnitResponse struct {
	ID             uuid.UUID  `json:"id"`
	OrganizationID uuid.UUID  `json:"organization_id"`
	OutletID       *uuid.UUID `json:"outlet_id"`
	Name           string     `json:"name"`
	Abbreviation   *string    `json:"abbreviation"`
	IsActive       bool       `json:"is_active"`
	DeletedAt      *time.Time `json:"deleted_at,omitempty"`
	CreatedAt      time.Time  `json:"created_at"`
	UpdatedAt      time.Time  `json:"updated_at"`
}
