package contract

import (
	"github.com/google/uuid"
)

type CreateChartOfAccountRequest struct {
	ChartOfAccountTypeID uuid.UUID  `json:"chart_of_account_type_id" validate:"required"`
	ParentID             *uuid.UUID `json:"parent_id"`
	Name                 string     `json:"name" validate:"required,min=1,max=255"`
	Code                 string     `json:"code" validate:"required,min=1,max=20"`
	Description          *string    `json:"description"`
}

type UpdateChartOfAccountRequest struct {
	ChartOfAccountTypeID *uuid.UUID `json:"chart_of_account_type_id"`
	ParentID             *uuid.UUID `json:"parent_id"`
	Name                 *string    `json:"name" validate:"omitempty,min=1,max=255"`
	Code                 *string    `json:"code" validate:"omitempty,min=1,max=20"`
	Description          *string    `json:"description"`
	IsActive             *bool      `json:"is_active"`
}

type ChartOfAccountResponse struct {
	ID                   uuid.UUID                 `json:"id"`
	OrganizationID       uuid.UUID                 `json:"organization_id"`
	OutletID             *uuid.UUID                `json:"outlet_id"`
	ChartOfAccountTypeID uuid.UUID                 `json:"chart_of_account_type_id"`
	ParentID             *uuid.UUID                `json:"parent_id"`
	Name                 string                    `json:"name"`
	Code                 string                    `json:"code"`
	Description          *string                   `json:"description"`
	IsActive             bool                      `json:"is_active"`
	IsSystem             bool                      `json:"is_system"`
	CreatedAt            string                    `json:"created_at"`
	UpdatedAt            string                    `json:"updated_at"`
	ChartOfAccountType   *ChartOfAccountTypeResponse `json:"chart_of_account_type,omitempty"`
	Parent               *ChartOfAccountResponse   `json:"parent,omitempty"`
	Children             []ChartOfAccountResponse  `json:"children,omitempty"`
}

type ListChartOfAccountsRequest struct {
	OrganizationID       *uuid.UUID `form:"organization_id"`
	OutletID             *uuid.UUID `form:"outlet_id"`
	ChartOfAccountTypeID *uuid.UUID `form:"chart_of_account_type_id"`
	ParentID             *uuid.UUID `form:"parent_id"`
	IsActive             *bool      `form:"is_active"`
	IsSystem             *bool      `form:"is_system"`
	Page                 int        `form:"page,default=1"`
	Limit                int        `form:"limit,default=10"`
}
