/**
 * WHMCS Catalog Provider - Raw Types
 * 
 * Type definitions for raw WHMCS API responses related to catalog/products.
 */

import { z } from "zod";

// ============================================================================
// WHMCS Catalog Product Pricing Cycle
// ============================================================================

const whmcsCatalogProductPricingCycleSchema = z.object({
  prefix: z.string(),
  suffix: z.string(),
  msetupfee: z.string(),
  qsetupfee: z.string(),
  ssetupfee: z.string(),
  asetupfee: z.string(),
  bsetupfee: z.string(),
  tsetupfee: z.string(),
  monthly: z.string(),
  quarterly: z.string(),
  semiannually: z.string(),
  annually: z.string(),
  biennially: z.string(),
  triennially: z.string(),
});

// ============================================================================
// WHMCS Catalog Product
// ============================================================================

const whmcsCatalogProductSchema = z.object({
  pid: z.number(),
  gid: z.number(),
  name: z.string(),
  description: z.string(),
  module: z.string(),
  paytype: z.string(),
  pricing: z.record(z.string(), whmcsCatalogProductPricingCycleSchema),
});

export type WhmcsCatalogProduct = z.infer<typeof whmcsCatalogProductSchema>;

// ============================================================================
// WHMCS Catalog Product List Response (GetProducts API)
// ============================================================================

/**
 * WHMCS GetProducts API response schema
 */
export const whmcsCatalogProductListResponseSchema = z.object({
  products: z.object({
    product: z.array(whmcsCatalogProductSchema),
  }),
  totalresults: z.number(),
});

export type WhmcsCatalogProductListResponse = z.infer<typeof whmcsCatalogProductListResponseSchema>;

