/**
 * Billing Domain - Constants
 *
 * Domain constants for billing validation and business rules.
 */

import type { Currency } from "./schema.js";

// ============================================================================
// Currency Defaults
// ============================================================================

/**
 * Single fallback currency for both BFF and Portal when WHMCS currency data
 * is unavailable. This ensures a single source of truth for default currency
 * formatting behaviour.
 */
export const FALLBACK_CURRENCY: Currency = {
  id: 1,
  code: "JPY",
  prefix: "¥",
  suffix: "",
  format: "1",
  rate: "1.00000",
};

// ============================================================================
// Invoice Validation Constants
// ============================================================================

/**
 * Pagination limits for invoice queries
 */
export const INVOICE_PAGINATION = {
  MIN_LIMIT: 1,
  MAX_LIMIT: 100,
  DEFAULT_LIMIT: 10,
  DEFAULT_PAGE: 1,
} as const;

/**
 * Valid invoice statuses for filtering
 * Matches the enum in schema.ts
 */
export const VALID_INVOICE_STATUSES = [
  "Paid",
  "Unpaid",
  "Cancelled",
  "Overdue",
  "Collections",
] as const;

/**
 * Invoice status for list filtering (subset of all statuses)
 */
export const VALID_INVOICE_LIST_STATUSES = VALID_INVOICE_STATUSES;

// ============================================================================
// Type Exports
// ============================================================================

export type ValidInvoiceStatus = (typeof VALID_INVOICE_STATUSES)[number];
export type ValidInvoiceListStatus = (typeof VALID_INVOICE_LIST_STATUSES)[number];
