package models import ( "time" "github.com/google/uuid" ) // PaymentMethodAnalyticsRequest represents the request for payment method analytics type PaymentMethodAnalyticsRequest struct { OrganizationID uuid.UUID `validate:"required"` OutletID *uuid.UUID `validate:"omitempty"` DateFrom time.Time `validate:"required"` DateTo time.Time `validate:"required"` GroupBy string `validate:"omitempty,oneof=day hour week month"` } // PaymentMethodAnalyticsResponse represents the response for payment method analytics type PaymentMethodAnalyticsResponse struct { OrganizationID uuid.UUID `json:"organization_id"` OutletID *uuid.UUID `json:"outlet_id,omitempty"` OutletName *string `json:"outlet_name,omitempty"` DateFrom time.Time `json:"date_from"` DateTo time.Time `json:"date_to"` GroupBy string `json:"group_by"` Summary PaymentMethodSummary `json:"summary"` Data []PaymentMethodAnalyticsData `json:"data"` } // PaymentMethodSummary represents the summary of payment method analytics type PaymentMethodSummary struct { TotalAmount float64 `json:"total_amount"` TotalOrders int64 `json:"total_orders"` TotalPayments int64 `json:"total_payments"` AverageOrderValue float64 `json:"average_order_value"` } // PaymentMethodAnalyticsData represents individual payment method analytics data type PaymentMethodAnalyticsData struct { PaymentMethodID uuid.UUID `json:"payment_method_id"` PaymentMethodName string `json:"payment_method_name"` PaymentMethodType string `json:"payment_method_type"` TotalAmount float64 `json:"total_amount"` OrderCount int64 `json:"order_count"` PaymentCount int64 `json:"payment_count"` Percentage float64 `json:"percentage"` } // SalesAnalyticsRequest represents the request for sales analytics type SalesAnalyticsRequest struct { OrganizationID uuid.UUID `validate:"required"` OutletID *uuid.UUID `validate:"omitempty"` DateFrom time.Time `validate:"required"` DateTo time.Time `validate:"required"` GroupBy string `validate:"omitempty,oneof=day hour week month"` } // SalesAnalyticsResponse represents the response for sales analytics type SalesAnalyticsResponse struct { OrganizationID uuid.UUID `json:"organization_id"` OutletID *uuid.UUID `json:"outlet_id,omitempty"` OutletName *string `json:"outlet_name,omitempty"` DateFrom time.Time `json:"date_from"` DateTo time.Time `json:"date_to"` GroupBy string `json:"group_by"` Summary SalesSummary `json:"summary"` Data []SalesAnalyticsData `json:"data"` } // SalesSummary represents the summary of sales analytics type SalesSummary struct { TotalSales float64 `json:"total_sales"` TotalOrders int64 `json:"total_orders"` TotalItems int64 `json:"total_items"` AverageOrderValue float64 `json:"average_order_value"` TotalTax float64 `json:"total_tax"` TotalDiscount float64 `json:"total_discount"` NetSales float64 `json:"net_sales"` } // SalesAnalyticsData represents individual sales analytics data point type SalesAnalyticsData struct { Date time.Time `json:"date"` Sales float64 `json:"sales"` Orders int64 `json:"orders"` Items int64 `json:"items"` Tax float64 `json:"tax"` Discount float64 `json:"discount"` NetSales float64 `json:"net_sales"` } // PurchasingAnalyticsRequest represents the request for purchasing analytics type PurchasingAnalyticsRequest struct { OrganizationID uuid.UUID `validate:"required"` OutletID *uuid.UUID `validate:"omitempty"` DateFrom time.Time `validate:"required"` DateTo time.Time `validate:"required"` GroupBy string `validate:"omitempty,oneof=day hour week month"` } // PurchasingAnalyticsResponse represents the response for purchasing analytics type PurchasingAnalyticsResponse struct { OrganizationID uuid.UUID `json:"organization_id"` OutletID *uuid.UUID `json:"outlet_id,omitempty"` OutletName *string `json:"outlet_name,omitempty"` DateFrom time.Time `json:"date_from"` DateTo time.Time `json:"date_to"` GroupBy string `json:"group_by"` Summary PurchasingSummary `json:"summary"` Data []PurchasingAnalyticsData `json:"data"` IngredientData []PurchasingIngredientData `json:"ingredient_data"` VendorData []PurchasingVendorData `json:"vendor_data"` } // PurchasingSummary represents the summary of purchasing analytics type PurchasingSummary struct { TotalPurchases float64 `json:"total_purchases"` RawMaterialPurchases float64 `json:"raw_material_purchases"` ExpensePurchases float64 `json:"expense_purchases"` TotalPurchaseOrders int64 `json:"total_purchase_orders"` RawMaterialPurchaseOrders int64 `json:"raw_material_purchase_orders"` ExpenseCount int64 `json:"expense_count"` TotalQuantity float64 `json:"total_quantity"` AveragePurchaseOrderValue float64 `json:"average_purchase_order_value"` TotalIngredients int64 `json:"total_ingredients"` TotalVendors int64 `json:"total_vendors"` } // PurchasingAnalyticsData represents purchasing analytics by time period type PurchasingAnalyticsData struct { Date time.Time `json:"date"` Purchases float64 `json:"purchases"` RawMaterialPurchases float64 `json:"raw_material_purchases"` ExpensePurchases float64 `json:"expense_purchases"` PurchaseOrders int64 `json:"purchase_orders"` RawMaterialPurchaseOrders int64 `json:"raw_material_purchase_orders"` ExpenseCount int64 `json:"expense_count"` Quantity float64 `json:"quantity"` Ingredients int64 `json:"ingredients"` Vendors int64 `json:"vendors"` } // PurchasingIngredientData represents purchasing analytics for an ingredient type PurchasingIngredientData struct { IngredientID uuid.UUID `json:"ingredient_id"` IngredientName string `json:"ingredient_name"` Quantity float64 `json:"quantity"` TotalCost float64 `json:"total_cost"` AverageUnitCost float64 `json:"average_unit_cost"` PurchaseOrderCount int64 `json:"purchase_order_count"` } // PurchasingVendorData represents purchasing analytics for a vendor type PurchasingVendorData struct { VendorID *uuid.UUID `json:"vendor_id"` VendorName string `json:"vendor_name"` TotalCost float64 `json:"total_cost"` PurchaseOrderCount int64 `json:"purchase_order_count"` IngredientCount int64 `json:"ingredient_count"` Quantity float64 `json:"quantity"` } // ProductAnalyticsRequest represents the request for product analytics type ProductAnalyticsRequest struct { OrganizationID uuid.UUID `validate:"required"` OutletID *uuid.UUID `validate:"omitempty"` DateFrom time.Time `validate:"required"` DateTo time.Time `validate:"required"` Limit int `validate:"min=1,max=100"` } // ProductAnalyticsResponse represents the response for product analytics type ProductAnalyticsResponse struct { OrganizationID uuid.UUID `json:"organization_id"` OutletID *uuid.UUID `json:"outlet_id,omitempty"` OutletName *string `json:"outlet_name,omitempty"` DateFrom time.Time `json:"date_from"` DateTo time.Time `json:"date_to"` Data []ProductAnalyticsData `json:"data"` } type ProductAnalyticsData struct { ProductID uuid.UUID `json:"product_id"` ProductName string `json:"product_name"` ProductSku string `json:"product_sku"` ProductPrice float64 `json:"product_price"` CategoryID uuid.UUID `json:"category_id"` CategoryName string `json:"category_name"` CategoryOrder int `json:"category_order"` QuantitySold int64 `json:"quantity_sold"` Revenue float64 `json:"revenue"` AveragePrice float64 `json:"average_price"` OrderCount int64 `json:"order_count"` StandardHppPerUnit float64 `json:"standard_hpp_per_unit"` StandardHppTotal float64 `json:"standard_hpp_total"` FifoHppPerUnit float64 `json:"fifo_hpp_per_unit"` FifoHppTotal float64 `json:"fifo_hpp_total"` MovingAverageHppPerUnit float64 `json:"moving_average_hpp_per_unit"` MovingAverageHppTotal float64 `json:"moving_average_hpp_total"` } // ProductAnalyticsPerCategoryRequest represents the request for product analytics per category type ProductAnalyticsPerCategoryRequest struct { OrganizationID uuid.UUID `validate:"required"` OutletID *uuid.UUID `validate:"omitempty"` DateFrom time.Time `validate:"required"` DateTo time.Time `validate:"required"` } // ProductAnalyticsPerCategoryResponse represents the response for product analytics per category type ProductAnalyticsPerCategoryResponse struct { OrganizationID uuid.UUID `json:"organization_id"` OutletID *uuid.UUID `json:"outlet_id,omitempty"` OutletName *string `json:"outlet_name,omitempty"` DateFrom time.Time `json:"date_from"` DateTo time.Time `json:"date_to"` Data []ProductAnalyticsPerCategoryData `json:"data"` } type ProductAnalyticsPerCategoryData struct { CategoryID uuid.UUID `json:"category_id"` CategoryName string `json:"category_name"` TotalRevenue float64 `json:"total_revenue"` TotalQuantity int64 `json:"total_quantity"` ProductCount int64 `json:"product_count"` OrderCount int64 `json:"order_count"` TotalStandardHpp float64 `json:"total_standard_hpp"` TotalFifoHpp float64 `json:"total_fifo_hpp"` TotalMovingAverageHpp float64 `json:"total_moving_average_hpp"` } // DashboardAnalyticsRequest represents the request for dashboard analytics type DashboardAnalyticsRequest struct { OrganizationID uuid.UUID `validate:"required"` OutletID *uuid.UUID `validate:"omitempty"` DateFrom time.Time `validate:"required"` DateTo time.Time `validate:"required"` } // DashboardAnalyticsResponse represents the response for dashboard analytics type DashboardAnalyticsResponse struct { OrganizationID uuid.UUID `json:"organization_id"` OutletID *uuid.UUID `json:"outlet_id,omitempty"` OutletName *string `json:"outlet_name,omitempty"` DateFrom time.Time `json:"date_from"` DateTo time.Time `json:"date_to"` Overview DashboardOverview `json:"overview"` TopProducts []ProductAnalyticsData `json:"top_products"` PaymentMethods []PaymentMethodAnalyticsData `json:"payment_methods"` RecentSales []SalesAnalyticsData `json:"recent_sales"` } // DashboardOverview represents the overview data for dashboard type DashboardOverview struct { TotalSales float64 `json:"total_sales"` TotalOrders int64 `json:"total_orders"` AverageOrderValue float64 `json:"average_order_value"` TotalCustomers int64 `json:"total_customers"` VoidedOrders int64 `json:"voided_orders"` RefundedOrders int64 `json:"refunded_orders"` TotalItemSold int64 `json:"total_item_sold"` TotalLowStock int64 `json:"total_low_stock"` TotalProductActive int64 `json:"total_product_active"` } type ProfitLossAnalyticsRequest struct { OrganizationID uuid.UUID `validate:"required"` OutletID *uuid.UUID `validate:"omitempty"` DateFrom time.Time `validate:"required"` DateTo time.Time `validate:"required"` GroupBy string `validate:"omitempty,oneof=day hour week month"` } type ProfitLossAnalyticsResponse struct { OrganizationID uuid.UUID `json:"organization_id"` OutletID *uuid.UUID `json:"outlet_id,omitempty"` OutletName *string `json:"outlet_name,omitempty"` DateFrom time.Time `json:"date_from"` DateTo time.Time `json:"date_to"` GroupBy string `json:"group_by"` Summary ProfitLossSummary `json:"summary"` Data []ProfitLossData `json:"data"` ProductData []ProductProfitData `json:"product_data"` MainSummary []ProfitLossSummaryRow `json:"main_summary"` Purchasing ProfitLossPurchasing `json:"purchasing"` OperationalExpenses []OperationalExpenseItem `json:"operational_expenses"` OperationalExpensesTotal float64 `json:"operational_expenses_total"` } type ProfitLossPurchasing struct { TodayTotal float64 `json:"today_total"` MtdTotal float64 `json:"mtd_total"` TodayRawMaterial float64 `json:"today_raw_material"` MtdRawMaterial float64 `json:"mtd_raw_material"` TodayExpense float64 `json:"today_expense"` MtdExpense float64 `json:"mtd_expense"` Items []ProfitLossPurchasingItem `json:"items"` } type ProfitLossPurchasingItem struct { Date time.Time `json:"date"` Item string `json:"item"` Quantity float64 `json:"quantity"` Nominal float64 `json:"nominal"` } type ProfitLossSummary struct { TotalRevenue float64 `json:"total_revenue"` TotalCost float64 `json:"total_cost"` GrossProfit float64 `json:"gross_profit"` GrossProfitMargin float64 `json:"gross_profit_margin"` TotalTax float64 `json:"total_tax"` TotalDiscount float64 `json:"total_discount"` NetProfit float64 `json:"net_profit"` NetProfitMargin float64 `json:"net_profit_margin"` TotalOrders int64 `json:"total_orders"` AverageProfit float64 `json:"average_profit"` ProfitabilityRatio float64 `json:"profitability_ratio"` } type ProfitLossData struct { Date time.Time `json:"date"` Revenue float64 `json:"revenue"` Cost float64 `json:"cost"` GrossProfit float64 `json:"gross_profit"` GrossProfitMargin float64 `json:"gross_profit_margin"` Tax float64 `json:"tax"` Discount float64 `json:"discount"` NetProfit float64 `json:"net_profit"` NetProfitMargin float64 `json:"net_profit_margin"` Orders int64 `json:"orders"` } type ProductProfitData struct { ProductID uuid.UUID `json:"product_id"` ProductName string `json:"product_name"` CategoryID uuid.UUID `json:"category_id"` CategoryName string `json:"category_name"` QuantitySold int64 `json:"quantity_sold"` Revenue float64 `json:"revenue"` Cost float64 `json:"cost"` GrossProfit float64 `json:"gross_profit"` GrossProfitMargin float64 `json:"gross_profit_margin"` AveragePrice float64 `json:"average_price"` AverageCost float64 `json:"average_cost"` ProfitPerUnit float64 `json:"profit_per_unit"` } type ProfitLossSummaryRow struct { ID string `json:"id"` Label string `json:"label"` IsBold bool `json:"is_bold"` TodayNominal float64 `json:"today_nominal"` TodayPct float64 `json:"today_pct"` MtdNominal float64 `json:"mtd_nominal"` MtdPct float64 `json:"mtd_pct"` SubItems []ProfitLossSummaryRow `json:"sub_items,omitempty"` } type OperationalExpenseItem struct { Item string `json:"item"` Nominal float64 `json:"nominal"` } type ExclusiveSummaryPeriodRequest struct { OrganizationID uuid.UUID `validate:"required"` OutletID *uuid.UUID `validate:"omitempty"` DateFrom time.Time `validate:"required"` DateTo time.Time `validate:"required"` ExcludeGajiStaffFromReimburse bool `validate:"omitempty"` } type ExclusiveSummaryMonthlyRequest struct { OrganizationID uuid.UUID `validate:"required"` OutletID *uuid.UUID `validate:"omitempty"` Month time.Time `validate:"required"` } type ExclusiveSummaryMTDRequest struct { OrganizationID uuid.UUID `validate:"required"` OutletID *uuid.UUID `validate:"omitempty"` DateTo time.Time `validate:"required"` ExcludeGajiStaffFromReimburse bool `validate:"omitempty"` } type ExclusiveSummaryPeriodResponse struct { OrganizationID uuid.UUID `json:"organization_id"` OutletID *uuid.UUID `json:"outlet_id,omitempty"` OutletName *string `json:"outlet_name,omitempty"` Period ExclusiveSummaryPeriodRange `json:"period"` Summary ExclusiveSummaryPeriodSummary `json:"summary"` Reimburse ExclusiveSummaryReimburse `json:"reimburse"` HPPBreakdown []ExclusiveSummaryCategoryBreakdown `json:"hpp_breakdown"` OperationalExpenseBreakdown []ExclusiveSummaryCategoryBreakdown `json:"operational_expense_breakdown"` DailySummary []ExclusiveSummaryDailySummary `json:"daily_summary"` DailyTransactions []ExclusiveSummaryDailyTransaction `json:"daily_transactions"` } type ExclusiveSummaryPeriodRange struct { DateFrom time.Time `json:"date_from"` DateTo time.Time `json:"date_to"` } type ExclusiveSummaryPeriodSummary struct { Sales float64 `json:"sales"` HPP float64 `json:"hpp"` GrossProfit float64 `json:"gross_profit"` SalaryTotal float64 `json:"salary_total"` SalaryDW float64 `json:"salary_dw"` SalaryStaff float64 `json:"salary_staff"` SalaryOther float64 `json:"salary_other"` OtherOperationalExpenses float64 `json:"other_operational_expenses"` OperationalExpensesTotal float64 `json:"operational_expenses_total"` TotalCost float64 `json:"total_cost"` NetProfit float64 `json:"net_profit"` } type ExclusiveSummaryReimburse struct { TotalCost float64 `json:"total_cost"` ExcludedSalaryStaff float64 `json:"excluded_salary_staff"` TotalReimburse float64 `json:"total_reimburse"` } type ExclusiveSummaryCategoryBreakdown struct { CategoryCode string `json:"category_code"` CategoryName string `json:"category_name"` Amount float64 `json:"amount"` Percentage float64 `json:"percentage"` } type ExclusiveSummaryDailySummary struct { Date time.Time `json:"date"` TransactionCount int64 `json:"transaction_count"` TotalCost float64 `json:"total_cost"` } type ExclusiveSummaryDailyTransaction struct { Date time.Time `json:"date"` CategoryCode string `json:"category_code"` CategoryName string `json:"category_name"` Description string `json:"description"` Amount float64 `json:"amount"` Source string `json:"source"` } type ExclusiveSummaryMonthlyResponse struct { OrganizationID uuid.UUID `json:"organization_id"` OutletID *uuid.UUID `json:"outlet_id,omitempty"` OutletName *string `json:"outlet_name,omitempty"` Month string `json:"month"` Summary ExclusiveSummaryMonthlySummary `json:"summary"` Periods []ExclusiveSummaryMonthlyPeriod `json:"periods"` BankBalance []ExclusiveSummaryBankBalance `json:"bank_balance"` } type ExclusiveSummaryMonthlySummary struct { TotalSales float64 `json:"total_sales"` HPP float64 `json:"hpp"` GrossProfit float64 `json:"gross_profit"` OperationalExpensesTotal float64 `json:"operational_expenses_total"` TotalCost float64 `json:"total_cost"` NetProfit float64 `json:"net_profit"` NetProfitMargin float64 `json:"net_profit_margin"` } type ExclusiveSummaryMonthlyPeriod struct { Label string `json:"label"` DateFrom time.Time `json:"date_from"` DateTo time.Time `json:"date_to"` Sales float64 `json:"sales"` HPP float64 `json:"hpp"` GrossProfit float64 `json:"gross_profit"` GrossMargin float64 `json:"gross_margin"` } type ExclusiveSummaryBankBalance struct { Bank string `json:"bank"` OpeningBalance *float64 `json:"opening_balance"` IncomingMutation *float64 `json:"incoming_mutation"` OutgoingMutation *float64 `json:"outgoing_mutation"` ClosingBalance *float64 `json:"closing_balance"` Notes *string `json:"notes"` }