package contract

import (
	"time"

	"github.com/google/uuid"
)

type CreateVendorRequest struct {
	Name          string  `json:"name" validate:"required,min=1,max=255"`
	Email         *string `json:"email,omitempty" validate:"omitempty,email"`
	PhoneNumber   *string `json:"phone_number,omitempty" validate:"omitempty"`
	Address       *string `json:"address,omitempty" validate:"omitempty"`
	ContactPerson *string `json:"contact_person,omitempty" validate:"omitempty,max=255"`
	TaxNumber     *string `json:"tax_number,omitempty" validate:"omitempty,max=50"`
	PaymentTerms  *string `json:"payment_terms,omitempty" validate:"omitempty,max=100"`
	Notes         *string `json:"notes,omitempty" validate:"omitempty"`
	IsActive      *bool   `json:"is_active,omitempty"`
}

type UpdateVendorRequest struct {
	Name          *string `json:"name,omitempty" validate:"omitempty,min=1,max=255"`
	Email         *string `json:"email,omitempty" validate:"omitempty,email"`
	PhoneNumber   *string `json:"phone_number,omitempty" validate:"omitempty"`
	Address       *string `json:"address,omitempty" validate:"omitempty"`
	ContactPerson *string `json:"contact_person,omitempty" validate:"omitempty,max=255"`
	TaxNumber     *string `json:"tax_number,omitempty" validate:"omitempty,max=50"`
	PaymentTerms  *string `json:"payment_terms,omitempty" validate:"omitempty,max=100"`
	Notes         *string `json:"notes,omitempty" validate:"omitempty"`
	IsActive      *bool   `json:"is_active,omitempty"`
}

type VendorResponse struct {
	ID             uuid.UUID `json:"id"`
	OrganizationID uuid.UUID `json:"organization_id"`
	Name           string    `json:"name"`
	Email          *string   `json:"email"`
	PhoneNumber    *string   `json:"phone_number"`
	Address        *string   `json:"address"`
	ContactPerson  *string   `json:"contact_person"`
	TaxNumber      *string   `json:"tax_number"`
	PaymentTerms   *string   `json:"payment_terms"`
	Notes          *string   `json:"notes"`
	IsActive       bool      `json:"is_active"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
}

type ListVendorsRequest struct {
	Page     int    `json:"page" validate:"min=1"`
	Limit    int    `json:"limit" validate:"min=1,max=100"`
	Search   string `json:"search,omitempty"`
	IsActive *bool  `json:"is_active,omitempty"`
}

type ListVendorsResponse struct {
	Vendors    []VendorResponse `json:"vendors"`
	TotalCount int              `json:"total_count"`
	Page       int              `json:"page"`
	Limit      int              `json:"limit"`
	TotalPages int              `json:"total_pages"`
}
