import type { CMSGallery, CMSImageType, CMSSharedCTA } from "./shared";

export interface CMSResortType {
  id: number;
  documentId: string;
  resortCode: string;
  name: string;
  slug: string;
  isFeatured: boolean;
  gallery: CMSImageType[];
  description: string;
  shortDescription: string;
  displayAddress: string;
  zipcode: string;
  province: string;
  country: {
    country: string;
  };
  longitude: number;
  latitude: number;
  mapImage: CMSImageType;
  mobileBanner: CMSImageType;
  thumbnail: CMSImageType;
  featuredImage?: CMSImageType;
  terms?: {
    terms: string;
    helperText: string;
  };
  layout?:
    | CMSResortBookingCTA
    | CMSResortPropertyType
    | ResortCuisine
    | CMSResortFacilities
    | CMSResortSpa
    | CMSResortWedding
    | CMSResortGuide
    | CMSResortSocialPlatforms
    | CMSGallery[];
}

export interface CMSResortBookingCTA {
  __component: "resort-components.booking-cta";
  description: string;
  cta: { label: string; link: string; isExternal: boolean };
  backgroundImage: {
    url: string;
    alternativeText: string;
  };
}

export interface CMSResortPropertyType {
  __component: "resort-components.property-type";
  id: number;
  name: string;
  description: string;
  images: CMSImageType[];
  type: "accommodation" | "residence";
  units: {
    id: number;
    unitCode: string;
    unitName: string;
    unitPrice: number;
    unitPoints: number;
    numberOfBeds: number;
    numberOfBedrooms: number;
    maximumGuests: number;
    description: string;
    featuredImage: CMSImageType;
    images: CMSImageType[];
    amenities: {
      id: number;
      type: string;
    }[];
  }[];
}
export interface ResortCuisine {
  __component: "resort-components.cuisine";
  description: string;
  variations: {
    id: number;
    name: string;
    description: string;
    menus: {
      id: number;
      label: string;
      attachment: {
        id: number;
        url: string;
      };
    }[];
    media: CMSImageType[];
    bookTable: {
      id: string;
      label: string;
      link: string;
      isExternal: boolean;
    };
  }[];
}
export interface CMSResortFacilities {
  __component: "resort-components.facilities";
  description: string;
  variations: {
    id: number;
    name: string;
    description: string;
    cta: CMSSharedCTA;
    media: CMSImageType[];
  }[];
}
export interface CMSResortSpa {
  __component: "resort-components.spa";
  description: string;
  variations: {
    id: number;
    name: string;
    description: string;
    bookingOptions: CMSSharedCTA[];
    menu: {
      label: string;
      attachment: {
        id: string;
        url: string;
      };
    };
    media: CMSImageType[];
  }[];
}
export interface CMSResortWedding {
  __component: "resort-components.wedding";
  description: string;
  brochure: {
    id: number;
    label: string;
    attachment: {
      id: number;
      url: string;
    };
  };
  options: {
    id: number;
    name: string;
    description: string;
    media: CMSImageType[];
    downloadOption: CMSSharedCTA;
  }[];
}
export interface CMSResortGuide {
  __component: "resort-components.resort-guide";
  guideURL: string;
  guideBrochure: {
    id: string;
    url: string;
  };
}
export interface CMSResortSocialPlatforms {
  __component: "resort-components.social-platforms";
  instagram?: string;
  twitter?: string;
  youtube?: string;
  tripAdvisor?: string;
  gmail?: string;
  whatsapp?: string;
}

export interface CMSCuratedExperienceType {
  id: number;
  documentId: string;
  name: string;
  slug: string;
  eventStartDate: string;
  eventEndDate: string;
  finalSpots: boolean;
  soldOut: boolean;
  thumbnail: CMSImageType;
  description: string;
  terms: string;
  slots: number;
  isActive: boolean;
  country: string;
  perHeadPrice: number;
  fullAddress: string;
  latitude: number;
  longitude: number;
  contactNumber: string;
  ticketCurrency: string;
  guestCount: string;
  displayAddress: string;
  maxTicketPerHead: number;
  isFeature: boolean;
  gallery: CMSImageType[];
  banner: CMSImageType;
  resortLogo: CMSImageType;
  mapImage: CMSImageType;
  event_categories?: CMSExperienceCategory[];
  sections?: (
    | CMSExperienceItinerary
    | CMSFeaturedExperience
    | CMSExperienceAccommodation
    | CMSExperienceSurvey
  )[];
  mobileBanner: CMSImageType;
  locationURL: string;
  longDescription: string;
}

export interface CMSExperienceCategory {
  id: number;
  documentId: string;
  categoryName: string;
  categoryLogo: CMSImageType;
}
export interface CMSFeaturedExperience {
  __component: "event-components.featured-event";
  featureImage: CMSImageType;
  featureNote: string;
}

export interface CMSExperienceItinerary {
  __component: "event-components.itinerary";
  id: number;
  date: string;
  description: string;
}

export interface CMSSubRating {
  id: number;
  title: string;
  icon: CMSImageType;
  ratingList: { rating: number; title: string }[];
}

export interface CMSExperienceSurvey {
  __component: "event-components.survey";
  id: number;
  title: string;
  maxStar: number;
  enableUserFeedback: boolean | null;
  stopSurveySubmission: boolean;
  subRating?: CMSSubRating[] | undefined;
  callbackConsent?:
    | {
        id: number;
        title: string;
        subTitle: string;
      }
    | undefined;
}

export interface CMSExperienceAccommodation {
  __component: "event-components.event-accommodation";
  id: number;
  startingAccommodationPrice: number;
  currency: string;
  resort: CMSResortType;
}

export interface CMSAdvertisementContentWebCta {
  path: string;
  isExternal: boolean;
}

export interface CMSAdvertisementContentMobileCta {
  route: string;
  slug: string;
  isExternal: boolean;
}

export interface CMSAdvertisementContentGeneral {
  image: CMSImageType;
  webCtaRedirect: CMSAdvertisementContentWebCta;
  mobileCtaRedirect: CMSAdvertisementContentMobileCta;
}
export interface CMSAdvertisementContentMemberSpecific {
  image: CMSImageType;
  webCtaRedirect: CMSAdvertisementContentWebCta;
  mobileCtaRedirect: CMSAdvertisementContentMobileCta;
  offerCardTitle: string;
  offerCardDescription: string;
  offerCardIcon: CMSImageType;
}
export interface CMSAdvertisementType {
  id: number;
  accountTypeIds: { number: number }[];
  emails: { textField: string }[];
  advertisementTrigger: "global" | "destination" | "experience";
  enableAd: boolean;
  repeatInterval: number;
  advertisementContent: (
    | CMSAdvertisementContentMemberSpecific
    | CMSAdvertisementContentGeneral
  )[];
  name: string;
  slug: string;
}
