package contract

import (
	"time"

	"github.com/google/uuid"
)

type CreateOutletRequest struct {
	OrganizationID uuid.UUID `json:"organization_id" validate:"required"`
	Name           string    `json:"name" validate:"required,min=1,max=255"`
	Address        string    `json:"address" validate:"required,min=1,max=500"`
	PhoneNumber    *string   `json:"phone_number,omitempty" validate:"omitempty,e164"`
	BusinessType   string    `json:"business_type" validate:"required,oneof=restaurant cafe bar fastfood retail"`
	Currency       string    `json:"currency" validate:"required,len=3"`
	TaxRate        float64   `json:"tax_rate" validate:"min=0,max=1"`
}

type UpdateOutletRequest struct {
	OrganizationID uuid.UUID
	Name           *string  `json:"name,omitempty" validate:"omitempty,min=1,max=255"`
	Address        *string  `json:"address,omitempty" validate:"omitempty,min=1,max=500"`
	PhoneNumber    *string  `json:"phone_number,omitempty" validate:"omitempty,e164"`
	TaxRate        *float64 `json:"tax_rate,omitempty" validate:"omitempty,min=0,max=1"`
	IsActive       *bool    `json:"is_active,omitempty"`
}

type OutletResponse struct {
	ID             uuid.UUID `json:"id"`
	OrganizationID uuid.UUID `json:"organization_id"`
	Name           string    `json:"name"`
	Address        string    `json:"address"`
	PhoneNumber    *string   `json:"phone_number"`
	BusinessType   string    `json:"business_type"`
	Currency       string    `json:"currency"`
	TaxRate        float64   `json:"tax_rate"`
	IsActive       bool      `json:"is_active"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
}

type ListOutletsRequest struct {
	Page           int       `json:"page" validate:"min=1"`
	Limit          int       `json:"limit" validate:"min=1,max=100"`
	Search         string    `json:"search,omitempty"`
	OrganizationID uuid.UUID `json:"organization_id,omitempty"`
	BusinessType   *string   `json:"business_type,omitempty" validate:"omitempty,oneof=restaurant cafe bar fastfood retail"`
	IsActive       *bool     `json:"is_active,omitempty"`
}

type ListOutletsResponse struct {
	Outlets    []OutletResponse `json:"outlets"`
	TotalCount int              `json:"total_count"`
	Page       int              `json:"page"`
	Limit      int              `json:"limit"`
	TotalPages int              `json:"total_pages"`
}
