import type { Product } from "@/data/products.data";
import type { Locale } from "@/lib/locales";
import type { ProductSlug } from "@/lib/routes";

export type PricingFeature =
  | string
  | {
      text: string;
      included?: boolean;
    };

export type ProductPricingPlan = {
  name: string;
  description: string;
  price: string;
  featured?: boolean;
  features: PricingFeature[];
};

export type ProductPricingLabels = {
  month: string;
  getStarted: string;
  mostPopular: string;
  custom: string;
  everythingInSilver: string;
  everythingInGold: string;
  basicReports: string;
  advancedReports: string;
  emailSupport: string;
  prioritySupport: string;
  premiumSupport: string;
  guidedSetup: string;
  automation: string;
  analyticsDashboard: string;
  roleBasedAccess: string;
  priorityOnboarding: string;
  multiBranch: string;
  customBranding: string;
  customWorkflows: string;
  dedicatedManager: string;
  apiIntegration: string;
  customReports: string;
};

type PricingFeatureGroup = readonly [
  readonly PricingFeature[],
  readonly PricingFeature[],
  readonly PricingFeature[],
  readonly PricingFeature[],
];

type ProductPricingCatalog = {
  prices: readonly [string, string, string, string];
  descriptions: Record<Locale, readonly [string, string, string, string]>;
  limits: Record<Locale, readonly [string, string, string, string]>;
  planNames?: Record<Locale, readonly [string, string, string, string]>;
  accounts: Record<Locale, readonly [string, string, string, string]>;
  features?: Record<Locale, PricingFeatureGroup>;
};

const labels: Record<Locale, ProductPricingLabels> = {
  en: {
    month: "/ Year",
    getStarted: "Get Started",
    mostPopular: "Most Popular",
    custom: "Custom",
    everythingInSilver: "Everything In Silver",
    everythingInGold: "Everything In Gold",
    basicReports: "Basic Reports",
    advancedReports: "Advanced Reports",
    emailSupport: "Email Support",
    prioritySupport: "Priority Support",
    premiumSupport: "Premium Support",
    guidedSetup: "Guided Setup",
    automation: "Workflow Automation",
    analyticsDashboard: "Analytics Dashboard",
    roleBasedAccess: "Role-Based Access",
    priorityOnboarding: "Priority Onboarding",
    multiBranch: "Multi-Branch Management",
    customBranding: "Custom Branding",
    customWorkflows: "Custom Workflows",
    dedicatedManager: "Dedicated Manager",
    apiIntegration: "API Integration",
    customReports: "Custom Reports",
  },
  hi: {
    month: "/ वर्ष",
    getStarted: "शुरू करें",
    mostPopular: "सबसे लोकप्रिय",
    custom: "कस्टम",
    everythingInSilver: "Silver की सभी सुविधाएं",
    everythingInGold: "Gold की सभी सुविधाएं",
    basicReports: "बेसिक रिपोर्ट्स",
    advancedReports: "एडवांस रिपोर्ट्स",
    emailSupport: "ईमेल सपोर्ट",
    prioritySupport: "प्रायोरिटी सपोर्ट",
    premiumSupport: "प्रीमियम सपोर्ट",
    guidedSetup: "गाइडेड सेटअप",
    automation: "वर्कफ्लो ऑटोमेशन",
    analyticsDashboard: "एनालिटिक्स डैशबोर्ड",
    roleBasedAccess: "रोल-आधारित एक्सेस",
    priorityOnboarding: "प्रायोरिटी ऑनबोर्डिंग",
    multiBranch: "मल्टी-ब्रांच मैनेजमेंट",
    customBranding: "कस्टम ब्रांडिंग",
    customWorkflows: "कस्टम वर्कफ्लो",
    dedicatedManager: "डेडिकेटेड मैनेजर",
    apiIntegration: "API इंटीग्रेशन",
    customReports: "कस्टम रिपोर्ट्स",
  },
  gu: {
    month: "/ વર્ષ",
    getStarted: "શરૂ કરો",
    mostPopular: "સૌથી લોકપ્રિય",
    custom: "કસ્ટમ",
    everythingInSilver: "Silverની બધી સુવિધાઓ",
    everythingInGold: "Goldની બધી સુવિધાઓ",
    basicReports: "બેઝિક રિપોર્ટ્સ",
    advancedReports: "એડવાન્સ રિપોર્ટ્સ",
    emailSupport: "ઇમેઇલ સપોર્ટ",
    prioritySupport: "પ્રાયોરિટી સપોર્ટ",
    premiumSupport: "પ્રીમિયમ સપોર્ટ",
    guidedSetup: "ગાઇડેડ સેટઅપ",
    automation: "વર્કફ્લો ઓટોમેશન",
    analyticsDashboard: "એનાલિટિક્સ ડૅશબોર્ડ",
    roleBasedAccess: "રોલ આધારિત ઍક્સેસ",
    priorityOnboarding: "પ્રાયોરિટી ઓનબોર્ડિંગ",
    multiBranch: "મલ્ટી-બ્રાન્ચ મેનેજમેન્ટ",
    customBranding: "કસ્ટમ બ્રાન્ડિંગ",
    customWorkflows: "કસ્ટમ વર્કફ્લો",
    dedicatedManager: "ડેડિકેટેડ મેનેજર",
    apiIntegration: "API ઇન્ટિગ્રેશન",
    customReports: "કસ્ટમ રિપોર્ટ્સ",
  },
};

const pricing: Record<ProductSlug, ProductPricingCatalog> = {
  pureestate: {
    prices: ["9,999", "17,999", "29,999", "47,999"],

    planNames: {
      en: ["Starter Plan", "Team Plan", "Growth Plan", "Pro Broker Plan"],
      hi: ["स्टार्टर प्लान", "टीम प्लान", "ग्रोथ प्लान", "प्रो ब्रोकर प्लान"],
      gu: ["સ્ટાર્ટર પ્લાન", "ટીમ પ્લાન", "ગ્રોથ પ્લાન", "પ્રો બ્રોકર પ્લાન"],
    },

    descriptions: {
      en: [
        "Best For Individual Brokers",
        "Best For Small Broker Offices",
        "Best For Growing Broker Teams",
        "Best For High-Volume Broker",
      ],
      hi: [
        "स्वतंत्र ब्रोकर्स के लिए सबसे अच्छा",
        "छोटे ब्रोकर ऑफिस के लिए सबसे अच्छा",
        "बढ़ती ब्रोकर टीमों के लिए सबसे अच्छा",
        "हाई-वॉल्यूम ब्रोकर के लिए सबसे अच्छा",
      ],
      gu: [
        "સ્વતંત્ર બ્રોકર્સ માટે શ્રેષ્ઠ",
        "નાના બ્રોકર ઓફિસ માટે શ્રેષ્ઠ",
        "વધતી બ્રોકર ટીમો માટે શ્રેષ્ઠ",
        "હાઈ-વોલ્યુમ બ્રોકર માટે શ્રેષ્ઠ",
      ],
    },

    limits: {
      en: [
        "Up to 50 Properties",
        "Up to 200 Properties",
        "Up to 500 Properties",
        "Up to 1500 Properties",
      ],
      hi: [
        "50 तक प्रॉपर्टीज",
        "200 तक प्रॉपर्टीज",
        "500 तक प्रॉपर्टीज",
        "1500 तक प्रॉपर्टीज",
      ],
      gu: [
        "50 સુધી પ્રોપર્ટીઝ",
        "200 સુધી પ્રોપર્ટીઝ",
        "500 સુધી પ્રોપર્ટીઝ",
        "1500 સુધી પ્રોપર્ટીઝ",
      ],
    },

    accounts: {
      en: [
        "1 Super Admin",
        "1 Super Admin + 1 Telecaller + 1 Visit Person",
        "1 Super Admin + 3 Telecallers + 2 Visit Person",
        "1 Super Admin + 5 Telecallers + 5 Visit Person",
      ],
      hi: [
        "1 सुपर एडमिन",
        "1 सुपर एडमिन + 1 टेलीकॉलर + 1 विजिट पर्सन",
        "1 सुपर एडमिन + 3 टेलीकॉलर + 2 विजिट पर्सन",
        "1 सुपर एडमिन + 5 टेलीकॉलर + 5 विजिट पर्सन",
      ],
      gu: [
        "1 સુપર એડમિન",
        "1 સુપર એડમિન + 1 ટેલિકોલર + 1 વિઝિટ પર્સન",
        "1 સુપર એડમિન + 3 ટેલિકોલર + 2 વિઝિટ પર્સન",
        "1 સુપર એડમિન + 5 ટેલિકોલર + 5 વિઝિટ પર્સન",
      ],
    },

    features: {
      en: [
        [
          { text: "1 Super Admin", included: true },
          { text: "Up to 50 Properties", included: true },
          { text: "Unlimited Leads", included: true },
          { text: "Basic Dashboard", included: true },
          { text: "Followup Reminders", included: true },
          { text: "No Telecaller", included: false },
          { text: "No Visit Person", included: false },
        ],
        [
          { text: "1 Super Admin", included: true },
          { text: "1 Telecaller", included: true },
          { text: "1 Visit Person", included: true },
          { text: "Up to 200 Properties", included: true },
          { text: "Unlimited Leads", included: true },
          { text: "Lead Assignment System", included: true },
          { text: "Basic WhatsApp Integration", included: true },
          { text: "Reports & Tracking", included: true },
        ],
        [
          { text: "1 Super Admin", included: true },
          { text: "3 Telecallers", included: true },
          { text: "2 Visit Person", included: true },
          { text: "Up to 500 Properties", included: true },
          { text: "Unlimited Leads", included: true },
          { text: "Auto Lead Distribution", included: true },
          { text: "WhatsApp Automation", included: true },
          { text: "Advanced Reports", included: true },
          { text: "Project-wise Tracking", included: true },
        ],
        [
          { text: "1 Super Admin", included: true },
          { text: "5 Telecallers", included: true },
          { text: "5 Visit Person", included: true },
          { text: "Up to 1500 Properties", included: true },
          { text: "Unlimited Leads", included: true },
          { text: "Advanced WhatsApp API", included: true },
          { text: "Full Sales Funnel Tracking", included: true },
          { text: "Channel Partner Tracking", included: true },
          { text: "Priority Support", included: true },
        ],
      ],
      hi: [
        [
          { text: "1 सुपर एडमिन", included: true },
          { text: "50 तक प्रॉपर्टीज", included: true },
          { text: "अनलिमिटेड लीड्स", included: true },
          { text: "बेसिक डैशबोर्ड", included: true },
          { text: "फॉलोअप रिमाइंडर्स", included: true },
          { text: "कोई टेलीकॉलर नहीं", included: false },
          { text: "कोई विजिट पर्सन नहीं", included: false },
        ],
        [
          { text: "1 सुपर एडमिन", included: true },
          { text: "1 टेलीकॉलर", included: true },
          { text: "1 विजिट पर्सन", included: true },
          { text: "200 तक प्रॉपर्टीज", included: true },
          { text: "अनलिमिटेड लीड्स", included: true },
          { text: "लीड असाइनमेंट सिस्टम", included: true },
          { text: "बेसिक WhatsApp इंटीग्रेशन", included: true },
          { text: "रिपोर्ट्स और ट्रैकिंग", included: true },
        ],
        [
          { text: "1 सुपर एडमिन", included: true },
          { text: "3 टेलीकॉलर", included: true },
          { text: "2 विजिट पर्सन", included: true },
          { text: "500 तक प्रॉपर्टीज", included: true },
          { text: "अनलिमिटेड लीड्स", included: true },
          { text: "ऑटो लीड डिस्ट्रीब्यूशन", included: true },
          { text: "WhatsApp ऑटोमेशन", included: true },
          { text: "एडवांस्ड रिपोर्ट्स", included: true },
          { text: "प्रोजेक्ट-वाइज ट्रैकिंग", included: true },
        ],
        [
          { text: "1 सुपर एडमिन", included: true },
          { text: "5 टेलीकॉलर", included: true },
          { text: "5 विजिट पर्सन", included: true },
          { text: "1500 तक प्रॉपर्टीज", included: true },
          { text: "अनलिमिटेड लीड्स", included: true },
          { text: "एडवांस्ड WhatsApp API", included: true },
          { text: "फुल सेल्स फनल ट्रैकिंग", included: true },
          { text: "चैनल पार्टनर ट्रैकिंग", included: true },
          { text: "प्रायोरिटी सपोर्ट", included: true },
        ],
      ],
      gu: [
        [
          { text: "1 સુપર એડમિન", included: true },
          { text: "50 સુધી પ્રોપર્ટીઝ", included: true },
          { text: "અનલિમિટેડ લીડ્સ", included: true },
          { text: "બેસિક ડેશબોર્ડ", included: true },
          { text: "ફોલોઅપ રિમાઇન્ડર્સ", included: true },
          { text: "ટેલિકોલર નથી", included: false },
          { text: "વિઝિટ પર્સન નથી", included: false },
        ],
        [
          { text: "1 સુપર એડમિન", included: true },
          { text: "1 ટેલિકોલર", included: true },
          { text: "1 વિઝિટ પર્સન", included: true },
          { text: "200 સુધી પ્રોપર્ટીઝ", included: true },
          { text: "અનલિમિટેડ લીડ્સ", included: true },
          { text: "લીડ અસાઇનમેન્ટ સિસ્ટમ", included: true },
          { text: "બેસિક WhatsApp ઇન્ટિગ્રેશન", included: true },
          { text: "રિપોર્ટ્સ અને ટ્રેકિંગ", included: true },
        ],
        [
          { text: "1 સુપર એડમિન", included: true },
          { text: "3 ટેલિકોલર્સ", included: true },
          { text: "2 વિઝિટ પર્સન", included: true },
          { text: "500 સુધી પ્રોપર્ટીઝ", included: true },
          { text: "અનલિમિટેડ લીડ્સ", included: true },
          { text: "ઓટો લીડ ડિસ્ટ્રિબ્યુશન", included: true },
          { text: "WhatsApp ઓટોમેશન", included: true },
          { text: "એડવાન્સ્ડ રિપોર્ટ્સ", included: true },
          { text: "પ્રોજેક્ટ-વાઇઝ ટ્રેકિંગ", included: true },
        ],
        [
          { text: "1 સુપર એડમિન", included: true },
          { text: "5 ટેલિકોલર્સ", included: true },
          { text: "5 વિઝિટ પર્સન", included: true },
          { text: "1500 સુધી પ્રોપર્ટીઝ", included: true },
          { text: "અનલિમિટેડ લીડ્સ", included: true },
          { text: "એડવાન્સ્ડ WhatsApp API", included: true },
          { text: "ફુલ સેલ્સ ફનલ ટ્રેકિંગ", included: true },
          { text: "ચેનલ પાર્ટનર ટ્રેકિંગ", included: true },
          { text: "પ્રાયોરિટી સપોર્ટ", included: true },
        ],
      ],
    },
  },

  buildpro: {
    prices: ["24,999", "49,999", "79,999", "1,20,000"],

    planNames: {
      en: ["Starter Builder", "Growth Builder", "Advanced Builder", "Enterprise Builder"],
      hi: ["स्टार्टर बिल्डर", "ग्रोथ बिल्डर", "एडवांस्ड बिल्डर", "एंटरप्राइज बिल्डर"],
      gu: ["સ્ટાર્ટર બિલ્ડર", "ગ્રોથ બિલ્ડર", "એડવાન્સ્ડ બિલ્ડર", "એન્ટરપ્રાઇઝ બિલ્ડર"],
    },

    descriptions: {
      en: [
        "Best For Small Builder Teams",
        "Growing builders with multiple projects",
        "Best For Growing Broker Teams",
        "Large Developers/ Multiple Sites",
      ],
      hi: [
        "छोटी बिल्डर टीमों के लिए सबसे अच्छा",
        "कई प्रोजेक्ट्स वाले बढ़ते बिल्डर्स के लिए",
        "बढ़ती ब्रोकर टीमों के लिए सबसे अच्छा",
        "बड़े डेवलपर्स / कई साइट्स के लिए",
      ],
      gu: [
        "નાની બિલ્ડર ટીમો માટે શ્રેષ્ઠ",
        "ઘણા પ્રોજેક્ટ્સ ધરાવતા વધતા બિલ્ડર્સ માટે",
        "વધતી બ्रोकर ટીમો માટે શ્રેષ્ઠ",
        "મોટા ડેવલપર્સ / ઘણી સાઇટ્સ માટે",
      ],
    },

    limits: {
      en: [
        "Up to 2 Projects",
        "Up to 5 Projects",
        "Up to 10 Projects",
        "Unlimited Projects",
      ],
      hi: [
        "2 तक प्रोजेक्ट्स",
        "5 तक प्रोजेक्ट्स",
        "10 तक प्रोजेक्ट्स",
        "अनलिमिटेड प्रोजेक्ट्स",
      ],
      gu: [
        "2 સુધી પ્રોજેક્ટ્સ",
        "5 સુધી પ્રોજેક્ટ્સ",
        "10 સુધી પ્રોજેક્ટ્સ",
        "અનલિમિટેડ પ્રોજેક્ટ્સ",
      ],
    },

    accounts: {
      en: [
        "1 Super Admin + 2 Telecallers + 1 Visit Person",
        "1 Super Admin + 5 Telecallers + 3 Visit Persons",
        "1 Super Admin + 10 Telecallers + 5 Visit Persons",
        "1 Super Admin + 20 Telecallers + 10 Visit Person",
      ],
      hi: [
        "1 सुपर एडमिन + 2 टेलीकॉलर्स + 1 विजिट पर्सन",
        "1 सुपर एडमिन + 5 टेलीकॉलर्स + 3 विजिट पर्सन",
        "1 सुपर एडमिन + 10 टेलीकॉलर्स + 5 विजिट पर्सन",
        "1 सुपर एडमिन + 20 टेलीकॉलर्स + 10 विजिट पर्सन",
      ],
      gu: [
        "1 સુપર એડમિન + 2 ટેલિકોલર્સ + 1 વિઝિટ પર્સન",
        "1 સુપર એડમિન + 5 ટેલિકોલર્સ + 3 વિઝિટ પર્સન",
        "1 સુપર એડમિન + 10 ટેલિકોલર્સ + 5 વિઝિટ પર્સન",
        "1 સુપર એડમિન + 20 ટેલિકોલર્સ + 10 વિઝિટ પર્સન",
      ],
    },

    features: {
      en: [
        [
          "1 Super Admin",
          "2 Telecallers",
          "1 Visit Person",
          "Up to 2 Projects",
          "Inventory Management (Units)",
          "Basic Booking Entry",
          "Up to 200 Units",
          "Lead Management",
          "Basic Reports",
        ],
        [
          "1 Super Admin",
          "5 Telecallers",
          "3 Visit Persons",
          "Up to 5 Projects",
          "Full Inventory Management",
          "Real Time Booking System",
          "Up to 800 Units",
          "Lead Auto Assignment",
          "WhatsApp Integration",
          "Sales Reports",
        ],
        [
          "1 Super Admin",
          "10 Telecallers",
          "5 Visit Persons",
          "Up to 10 Projects",
          "Advanced Inventory + Availability",
          "Real Time Booking + Blocking System",
          "Up to 2000 Units",
          "Project-wise Sales Dashboard",
          "WhatsApp Automation",
          "Advanced Analytics",
        ],
        [
          "1 Super Admin",
          "20 Telecallers",
          "10 Visit Person",
          "Unlimited Projects",
          "Unlimited Inventory Units",
          "Live Booking + Inventory Sync",
          "Channel Partner Management",
          "Full Sales Funnel Tracking",
          "API Integrations",
          "Priority Support",
        ],
      ],
      hi: [
        [
          "1 सुपर एडमिन",
          "2 टेलीकॉलर्स",
          "1 विजिट पर्सन",
          "2 तक प्रोजेक्ट्स",
          "इन्वेंटरी मैनेजमेंट (यूनिट्स)",
          "बेसिक बुकिंग एंट्री",
          "200 तक यूनिट्स",
          "लीड मैनेजमेंट",
          "बेसिक रिपोर्ट्स",
        ],
        [
          "1 सुपर एडमिन",
          "5 टेलीकॉलर्स",
          "3 विजिट पर्सन",
          "5 तक प्रोजेक्ट्स",
          "फुल इन्वेंटरी मैनेजमेंट",
          "रीयल टाइम बुकिंग सिस्टम",
          "800 तक यूनिट्स",
          "लीड ऑटो असाइनमेंट",
          "WhatsApp इंटीग्रेशन",
          "सेल्स रिपोर्ट्स",
        ],
        [
          "1 सुपर एडमिन",
          "10 टेलीकॉलर्स",
          "5 विजिट पर्सन",
          "10 तक प्रोजेक्ट्स",
          "एडवांस्ड इन्वेंटरी + उपलब्धता",
          "रीयल टाइम बुकिंग + ब्लॉकिंग सिस्टम",
          "2000 तक यूनिट्स",
          "प्रोजेक्ट-वाइज सेल्स डैशबोर्ड",
          "WhatsApp ऑटोमेशन",
          "एडवांस्ड एनालिटिक्स",
        ],
        [
          "1 सुपर एडमिन",
          "20 टेलीकॉलर्स",
          "10 विजिट पर्सन",
          "अनलिमिटेड प्रोजेक्ट्स",
          "अनलिमिटेड इन्वेंटरी यूनिट्स",
          "लाइव बुकिंग + इन्वेंटरी सिंक",
          "चैनल पार्टनर मैनेजमेंट",
          "फुल सेल्स फनल ट्रैकिंग",
          "API इंटीग्रेशन",
          "प्रायोरिटी सपोर्ट",
        ],
      ],
      gu: [
        [
          "1 સુપર એડમિન",
          "2 ટેલિકોલર્સ",
          "1 વિઝિટ પર્સન",
          "2 સુધી પ્રોજેક્ટ્સ",
          "ઇન્વેન્ટરી મેનેજમેન્ટ (યુનિટ્સ)",
          "બેસિક બુકિંગ એન્ટ્રી",
          "200 સુધી યુનિટ્સ",
          "લીડ મેનેજમેન્ટ",
          "બેસિક રિપોર્ટ્સ",
        ],
        [
          "1 સુપર એડમિન",
          "5 ટેલિકોલર્સ",
          "3 વિઝિટ પર્સન",
          "5 સુધી પ્રોજેક્ટ્સ",
          "ફુલ ઇન્વેન્ટરી મેનેજમેન્ટ",
          "રીયલ ટાઈમ બુકિંગ સિસ્ટમ",
          "800 સુધી યુનિટ્સ",
          "લીડ ઓટો અસાઇનમેન્ટ",
          "WhatsApp ઇન્ટિગ્રેશન",
          "સેલ્સ રિપોર્ટ્સ",
        ],
        [
          "1 સુપર એડમિન",
          "10 ટેલિકોલર્સ",
          "5 વિઝિટ પર્સન",
          "10 સુધી પ્રોજેક્ટ્સ",
          "એડવાન્સ્ડ ઇન્વેન્ટરી + ઉપલબ્ધતા",
          "રીયલ ટાઈમ બુકિંગ + બ્લોકિંગ સિસ્ટમ",
          "2000 સુધી યુનિટ્સ",
          "પ્રોજેક્ટ-વાઇઝ સેલ્સ ડેશબોર્ડ",
          "WhatsApp ઓટોમેશન",
          "એડવાન્સ્ડ એનાલિટિક્સ",
        ],
        [
          "1 સુપર એડમિન",
          "20 ટેલિકોલર્સ",
          "10 વિઝિટ પર્સન",
          "અનલિમિટેડ પ્રોજેક્ટ્સ",
          "અનલિમિટેડ ઇન્વેન્ટરી યુનિટ્સ",
          "લાઇવ બુકિંગ + ઇન્વેન્ટરી સિંક",
          "ચેનલ પાર્ટનર મેનેજમેન્ટ",
          "ફુલ સેલ્સ ફનલ ટ્રેકિંગ",
          "API ઇન્ટિગ્રેશન",
          "પ્રાયોરિટી સપોર્ટ",
        ],
      ],
    },
  },

  societypro: {
    prices: ["2,999", "5,999", "9,999", "custom"],

    planNames: {
      en: ["Starter Society", "Growth Society", "Advanced Society", "Enterprise Society"],
      hi: ["स्टार्टर सोसाइटी", "ग्रोथ सोसाइटी", "एडवांस्ड सोसाइटी", "एंटरप्राइज सोसाइटी"],
      gu: ["સ્ટાર્ટર સોસાયટી", "ગ્રોથ સોસાયટી", "એડવાન્સ્ડ સોસાયટી", "એન્ટરપ્રાઇઝ સોસાયટી"],
    },

    descriptions: {
      en: [
        "Ideal For Small Housing Societies",
        "Most Popular For Growing Societies",
        "Perfect For Large Residential Communities",
        "For Township & Multi-Society Management",
      ],
      hi: [
        "छोटी हाउसिंग सोसाइटी के लिए उपयुक्त",
        "बढ़ती सोसाइटी के लिए सबसे लोकप्रिय",
        "बड़ी रेजिडेंशियल कम्युनिटी के लिए सही",
        "टाउनशिप और मल्टी-सोसाइटी मैनेजमेंट के लिए",
      ],
      gu: [
        "નાની હાઉસિંગ સોસાયટી માટે યોગ્ય",
        "વધતી સોસાયટી માટે સૌથી લોકપ્રિય",
        "મોટી રેસિડેન્શિયલ કમ્યુનિટી માટે ઉત્તમ",
        "ટાઉનશિપ અને મલ્ટી-સોસાયટી મેનેજમેન્ટ માટે",
      ],
    },

    limits: {
      en: [
        "Up to 100 Flats",
        "Up to 500 Flats",
        "Up to 1500 Flats",
        "Unlimited Flats",
      ],
      hi: [
        "100 तक फ्लैट्स",
        "500 तक फ्लैट्स",
        "1500 तक फ्लैट्स",
        "अनलिमिटेड फ्लैट्स",
      ],
      gu: [
        "100 સુધી ફ્લેટ્સ",
        "500 સુધી ફ્લેટ્સ",
        "1500 સુધી ફ્લેટ્સ",
        "અનલિમિટેડ ફ્લેટ્સ",
      ],
    },

    accounts: {
      en: [
        "1 Admin Account",
        "3 Admin Accounts",
        "10 Admin Accounts",
        "Unlimited Admin Accounts",
      ],
      hi: [
        "1 एडमिन अकाउंट",
        "3 एडमिन अकाउंट्स",
        "10 एडमिन अकाउंट्स",
        "अनलिमिटेड एडमिन अकाउंट्स",
      ],
      gu: [
        "1 એડમિન અકાઉન્ટ",
        "3 એડમિન અકાઉન્ટ્સ",
        "10 એડમિન અકાઉન્ટ્સ",
        "અનલિમિટેડ એડમિન અકાઉન્ટ્સ",
      ],
    },
  },
};

export function getProductPricingLabels(locale: Locale) {
  return labels[locale];
}

export function getProductPricingPlans(
  locale: Locale,
  product: Product,
): ProductPricingPlan[] {
  const copy = labels[locale];
  const catalog = pricing[product.slug];

  const featureOne = product.features[0] ?? product.name;
  const featureTwo = product.features[1] ?? product.overview;
  const featureThree = product.features[2] ?? product.overview;
  const featureFour = product.features[3] ?? product.overview;
  const featureFive = product.features[4] ?? product.overview;
  const featureSix = product.features[5] ?? product.overview;

  const benefitOne = product.benefits[0] ?? product.overview;
  const benefitTwo = product.benefits[1] ?? product.overview;
  const benefitThree = product.benefits[2] ?? product.overview;
  const benefitFour = product.benefits[3] ?? product.overview;

  const names =
    catalog.planNames?.[locale] ??
    ([
      `${product.name} Silver`,
      `${product.name} Gold`,
      `${product.name} Platinum`,
      `${product.name} Enterprise`,
    ] as const);

  const includedPlan = (name: string) => {
    if (locale === "hi") return `${name} की सभी सुविधाएं`;
    if (locale === "gu") return `${name}ની બધી સુવિધાઓ`;
    return `Everything In ${name}`;
  };

  const fallbackFeatures: Record<
    ProductSlug,
    [PricingFeature[], PricingFeature[], PricingFeature[], PricingFeature[]]
  > = {
    pureestate: [
      [
        catalog.limits[locale][0],
        catalog.accounts[locale][0],
        featureOne,
        featureTwo,
        featureThree,
        featureFour,
        featureFive,
        copy.basicReports,
        copy.emailSupport,
      ],
      [
        catalog.limits[locale][1],
        catalog.accounts[locale][1],
        includedPlan(names[0]),
        featureFive,
        featureSix,
        benefitOne,
        benefitTwo,
        copy.automation,
        copy.advancedReports,
        copy.prioritySupport,
      ],
      [
        catalog.limits[locale][2],
        catalog.accounts[locale][2],
        includedPlan(names[1]),
        featureSix,
        benefitThree,
        benefitFour,
        copy.roleBasedAccess,
        copy.analyticsDashboard,
        copy.priorityOnboarding,
      ],
      [
        catalog.limits[locale][3],
        catalog.accounts[locale][3],
        copy.multiBranch,
        copy.customBranding,
        copy.customWorkflows,
        copy.dedicatedManager,
        copy.apiIntegration,
        copy.customReports,
        copy.premiumSupport,
      ],
    ],
    buildpro: [
      [
        catalog.limits[locale][0],
        catalog.accounts[locale][0],
        featureOne,
        featureTwo,
        featureThree,
        featureFour,
        featureFive,
        copy.basicReports,
        copy.emailSupport,
        copy.guidedSetup,
      ],
      [
        catalog.limits[locale][1],
        catalog.accounts[locale][1],
        includedPlan(names[0]),
        featureFour,
        featureFive,
        featureSix,
        benefitOne,
        benefitTwo,
        copy.advancedReports,
        copy.prioritySupport,
      ],
      [
        catalog.limits[locale][2],
        catalog.accounts[locale][2],
        includedPlan(names[1]),
        featureSix,
        benefitThree,
        benefitFour,
        copy.automation,
        copy.roleBasedAccess,
        copy.analyticsDashboard,
        copy.priorityOnboarding,
      ],
      [
        catalog.limits[locale][3],
        catalog.accounts[locale][3],
        copy.multiBranch,
        copy.customBranding,
        copy.customWorkflows,
        copy.dedicatedManager,
        copy.apiIntegration,
        copy.customReports,
        copy.premiumSupport,
      ],
    ],
    societypro: [
      [
        catalog.limits[locale][0],
        catalog.accounts[locale][0],
        featureOne,
        featureFive,
        featureTwo,
        featureFour,
        copy.basicReports,
        copy.emailSupport,
      ],
      [
        catalog.limits[locale][1],
        catalog.accounts[locale][1],
        includedPlan(names[0]),
        featureThree,
        featureSix,
        benefitOne,
        benefitTwo,
        copy.advancedReports,
        copy.prioritySupport,
      ],
      [
        catalog.limits[locale][2],
        catalog.accounts[locale][2],
        includedPlan(names[1]),
        benefitThree,
        benefitFour,
        featureSix,
        copy.automation,
        copy.analyticsDashboard,
        copy.priorityOnboarding,
      ],
      [
        catalog.limits[locale][3],
        catalog.accounts[locale][3],
        copy.multiBranch,
        copy.customBranding,
        copy.customWorkflows,
        copy.dedicatedManager,
        copy.apiIntegration,
        copy.customReports,
        copy.premiumSupport,
      ],
    ],
  };

  const tierIndexes = [0, 1, 2, 3] as const;

  return tierIndexes.map((index) => {
    const directFeatures = catalog.features?.[locale]?.[index];

    return {
      name: names[index],
      description: catalog.descriptions[locale][index],
      price:
        catalog.prices[index] === "custom"
          ? copy.custom
          : catalog.prices[index],
      featured: index === 1,
      features: directFeatures
        ? [...directFeatures]
        : fallbackFeatures[product.slug][index],
    };
  });
}