/**
 * Address Domain - Constants
 *
 * Field length limits for address validation.
 * These limits ensure composed values fit within WHMCS API constraints.
 */

// ============================================================================
// WHMCS Address Field Limits
// ============================================================================

/**
 * Maximum lengths for WHMCS address API fields.
 * These are the hard limits imposed by the WHMCS system.
 */
export const WHMCS_ADDRESS_LIMITS = {
  /** Maximum length for address1 field (building + room) */
  ADDRESS1_MAX: 200,
  /** Maximum length for address2 field (town + street address) */
  ADDRESS2_MAX: 200,
  /** Maximum length for city field */
  CITY_MAX: 100,
  /** Maximum length for state field */
  STATE_MAX: 100,
} as const;

// ============================================================================
// Input Field Limits
// ============================================================================

/**
 * Maximum lengths for user input fields.
 * Calculated to ensure composed values fit within WHMCS limits.
 *
 * Building + Room composition for WHMCS address1:
 * - "Building Name Room123" = buildingName + " " + roomNumber
 * - Max: 169 + 1 (space) + 30 = 200 chars
 */
export const ADDRESS_INPUT_LIMITS = {
  /**
   * Building name max length (169 chars).
   * Calculation: WHMCS_ADDRESS1_MAX(200) - space(1) - ROOM_NUMBER_MAX(30) = 169
   */
  BUILDING_NAME_MAX: 169,

  /**
   * Room number max length (30 chars).
   * Allows for long format like "Room 2051-A-Special"
   */
  ROOM_NUMBER_MAX: 30,

  /**
   * Street address max length (20 chars).
   * Format: chome-banchi-go (e.g., "99-999-999")
   * Already enforced by streetAddressDetailSchema regex.
   */
  STREET_ADDRESS_MAX: 20,
} as const;
