import mongoose, { Document, Schema } from 'mongoose';

export interface ILocalizedString {
  en: string;
  zh: string;
}

const localizedStringSchema = {
  en: { type: String, default: '' },
  zh: { type: String, default: '' },
};

export interface IGolfDevelopmentFund extends Document {
  heroTitle: ILocalizedString;
  heroSubtitle: ILocalizedString;
  heroImage?: string;
  operationTitle: ILocalizedString;
  operationDescription: ILocalizedString;
  operationSteps: Array<{
    title: ILocalizedString;
    description: ILocalizedString;
    image?: string;
  }>;
  ctaBanner: {
    title: ILocalizedString;
    description: ILocalizedString;
    buttonText: ILocalizedString;
    buttonUrl: string;
  };
  investmentTitle: ILocalizedString;
  investmentDescription: ILocalizedString;
  investmentAreas: Array<{
    title: ILocalizedString;
    description: ILocalizedString;
    image?: string;
  }>;
  updatedAt: Date;
}

const golfDevelopmentFundSchema = new Schema<IGolfDevelopmentFund>(
  {
    heroTitle: {
      type: localizedStringSchema,
      default: { en: 'Golf Development Fund', zh: '高爾夫發展基金' },
    },
    heroSubtitle: {
      type: localizedStringSchema,
      default: { en: '', zh: '' },
    },
    heroImage: String,
    operationTitle: {
      type: localizedStringSchema,
      default: { en: 'Operation Mode', zh: '運作模式' },
    },
    operationDescription: {
      type: localizedStringSchema,
      default: { en: '', zh: '' },
    },
    operationSteps: [
      {
        title: { type: localizedStringSchema },
        description: { type: localizedStringSchema },
        image: String,
      },
    ],
    ctaBanner: {
      title: { type: localizedStringSchema, default: { en: '', zh: '' } },
      description: { type: localizedStringSchema, default: { en: '', zh: '' } },
      buttonText: { type: localizedStringSchema, default: { en: '', zh: '' } },
      buttonUrl: { type: String, default: '' },
    },
    investmentTitle: {
      type: localizedStringSchema,
      default: {
        en: 'Investment in Golf Platform Development',
        zh: '投資高爾夫平台發展',
      },
    },
    investmentDescription: {
      type: localizedStringSchema,
      default: { en: '', zh: '' },
    },
    investmentAreas: [
      {
        title: { type: localizedStringSchema },
        description: { type: localizedStringSchema },
        image: String,
      },
    ],
  },
  {
    timestamps: true,
  }
);

export const GolfDevelopmentFund = mongoose.model<IGolfDevelopmentFund>(
  'GolfDevelopmentFund',
  golfDevelopmentFundSchema
);
