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 IPartners extends Document {
  heroTitle: ILocalizedString;
  heroSubtitle: ILocalizedString;
  heroImage?: string;
  partners: Array<{
    name: ILocalizedString;
    logo?: string;
    description: ILocalizedString;
    website?: string;
  }>;
  updatedAt: Date;
}

const partnersSchema = new Schema<IPartners>(
  {
    heroTitle: {
      type: localizedStringSchema,
      default: { en: 'Business Partners', zh: '商業夥伴' },
    },
    heroSubtitle: {
      type: localizedStringSchema,
      default: {
        en: 'Our strategic partners across the golf industry help us deliver exceptional experiences and value to Golf ID members.',
        zh: '我們的高爾夫行業戰略合作夥伴幫助我們為高球証會員提供卓越的體驗和價值。',
      },
    },
    heroImage: String,
    partners: [
      {
        name: { type: localizedStringSchema },
        logo: String,
        description: { type: localizedStringSchema },
        website: String,
      },
    ],
  },
  {
    timestamps: true,
  }
);

export const Partners = mongoose.model<IPartners>('Partners', partnersSchema);
