package contract

import (
	"time"

	"github.com/google/uuid"
)

type CreateOrganizationRequest struct {
	OrganizationName        string  `json:"organization_name" validate:"required,min=1,max=255"`
	OrganizationEmail       *string `json:"organization_email,omitempty" validate:"omitempty,email"`
	OrganizationPhoneNumber *string `json:"organization_phone_number,omitempty"`
	PlanType                string  `json:"plan_type" validate:"required,oneof=basic premium enterprise"`

	AdminName     string `json:"admin_name" validate:"required,min=1,max=255"`
	AdminEmail    string `json:"admin_email" validate:"required,email"`
	AdminPassword string `json:"admin_password" validate:"required,min=6"`

	OutletName     string  `json:"outlet_name" validate:"required,min=1,max=255"`
	OutletAddress  *string `json:"outlet_address,omitempty"`
	OutletTimezone *string `json:"outlet_timezone,omitempty"`
	OutletCurrency string  `json:"outlet_currency" validate:"required,len=3"`
}

type UpdateOrganizationRequest 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"`
	PlanType    *string `json:"plan_type,omitempty" validate:"omitempty,oneof=basic premium enterprise"`
}

type OrganizationResponse struct {
	ID          uuid.UUID `json:"id"`
	Name        string    `json:"name"`
	Email       *string   `json:"email"`
	PhoneNumber *string   `json:"phone_number"`
	PlanType    string    `json:"plan_type"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

type CreateOrganizationResponse struct {
	Organization  OrganizationResponse `json:"organization"`
	AdminUser     UserResponse         `json:"admin_user"`
	DefaultOutlet OutletResponse       `json:"default_outlet"`
}

type ListOrganizationsRequest struct {
	Page     int    `json:"page" validate:"min=1"`
	Limit    int    `json:"limit" validate:"min=1,max=100"`
	Search   string `json:"search,omitempty"`
	PlanType string `json:"plan_type,omitempty" validate:"omitempty,oneof=basic premium enterprise"`
}

type ListOrganizationsResponse struct {
	Organizations []OrganizationResponse `json:"organizations"`
	TotalCount    int                    `json:"total_count"`
	Page          int                    `json:"page"`
	Limit         int                    `json:"limit"`
	TotalPages    int                    `json:"total_pages"`
}
