package models

import (
	"time"

	"github.com/google/uuid"
)

type Vendor 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 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 CreateVendorRequest struct {
	Name          string  `json:"name"`
	Email         *string `json:"email,omitempty"`
	PhoneNumber   *string `json:"phone_number,omitempty"`
	Address       *string `json:"address,omitempty"`
	ContactPerson *string `json:"contact_person,omitempty"`
	TaxNumber     *string `json:"tax_number,omitempty"`
	PaymentTerms  *string `json:"payment_terms,omitempty"`
	Notes         *string `json:"notes,omitempty"`
	IsActive      *bool   `json:"is_active,omitempty"`
}

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

type ListVendorsRequest struct {
	Page     int    `json:"page"`
	Limit    int    `json:"limit"`
	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"`
}
