export interface PricingFeature {
  iconSrc: string;
  iconAlt: string;
  text: string;
}

export interface BasePricingPlan {
  title: string;
  description: string;
  buttonText: string;
  buttonHref: string;
  features: PricingFeature[];
  variant?: string;
}

export interface PricingPlan extends BasePricingPlan {
  price: string;
  period: string;
}

export interface PricingSectionData {
  subTitle: string;
  title: string;
  description: string;
  tabs: {
    monthly: string;
    yearly: string;
  };
  plans: {
    monthly: PricingPlan[];
    yearly: PricingPlan[];
  };
}

// Helper function to create features with default icon
const createFeature = (text: string): PricingFeature => ({
  iconSrc: "/assets/images/icon/check1-4.svg",
  iconAlt: "Check Icon",
  text,
});

// Shared feature data to eliminate duplication
const regularPackageFeatures: PricingFeature[] = [
  createFeature("1 chatbot platform"),
  createFeature("100 conversations/month"),
  createFeature("Basic NLP support"),
  createFeature("Limited customization"),
  createFeature("Basic SEO Optimization"),
  createFeature("Email support"),
];

const customPackageFeatures: PricingFeature[] = [
  createFeature("5 chatbot platforms"),
  createFeature("600 conversations/month"),
  createFeature("Advance NLP support"),
  createFeature("Unlimited customization"),
  createFeature("Advanced SEO Optimization"),
  createFeature("Email support 24/7"),
];

// Base plan configurations
const basePlans: BasePricingPlan[] = [
  {
    title: "Regular Package",
    description: "Perfect for individuals or small businesses.",
    buttonText: "Choose Plan",
    buttonHref: "/contact",
    variant: "v2",
    features: regularPackageFeatures,
  },
  {
    title: "Custom Package",
    description: "Perfect for individuals or small businesses.",
    buttonText: "Choose Plan",
    buttonHref: "/contact",
    features: customPackageFeatures,
  },
];

// Pricing configurations
const pricingConfig = {
  monthly: {
    regular: { price: "$18", period: "/month" },
    custom: { price: "$98", period: "/month" },
  },
  yearly: {
    regular: { price: "$199", period: "/year" },
    custom: { price: "$499", period: "/year" },
  },
};

// Helper function to create pricing plans
const createPricingPlan = (
  basePlan: BasePricingPlan,
  pricing: { price: string; period: string },
): PricingPlan => ({
  ...basePlan,
  ...pricing,
});

export const pricingData: PricingSectionData = {
  subTitle: "Pricing Package",
  title: "Simple & transparent pricing",
  description:
    "Choose a plan that matches your needs and budget. Our pricing packages are designed to be simple and flexible.",
  tabs: {
    monthly: "Monthly",
    yearly: "Yearly",
  },
  plans: {
    monthly: [
      createPricingPlan(basePlans[0], pricingConfig.monthly.regular),
      createPricingPlan(basePlans[1], pricingConfig.monthly.custom),
    ],
    yearly: [
      createPricingPlan(basePlans[0], pricingConfig.yearly.regular),
      createPricingPlan(basePlans[1], pricingConfig.yearly.custom),
    ],
  },
};
