export type PromoItem = {
  iconSrc: string | null;
  title: string;
  subtitle: string;
};

export type HeroBlock = {
  blockType: "hero";
  logoHref: string;
  logoSrc: string | null;
  logoAlt: string;
  heroImageLandscape: string | null;
  heroImagePortrait: string | null;
  headline1: string;
  headline2: string;
  ctaLabel: string;
  ctaHref: string;
  ctaId?: string | null;
  promoItems: PromoItem[];
};

export type IntroTextBlock = {
  blockType: "introText";
  heading?: string;
  paragraphs?: string[];
};

export type TitleBlock = {
  icon: string | null;
  heading: string;
  subText?: string;
};

export type Package = {
  title: string;
  nights: string;
  price: string;
  subtitle: string;
  description: string;
  image: string;
  icon: string;
};

export type Inclusion = {
  title: string;
  description: string;
  image: string;
  icon: string;
};

export type ExpectItem = {
  title: string;
  description: string;
  image: string;
  icon: string;
};

export type CtaBlock = {
  headline: string;
  paragraphs: string[];
  buttonLabel: string;
  buttonHref: string;
};

export type CardsBlock = {
  blockType: "cards";
  titleBlock: TitleBlock;
  inclusionsTitle: { icon: string | null; heading: string };
  expectTitle: { icon: string | null; heading: string };
  packages: Package[];
  inclusions: Inclusion[];
  expectItems: ExpectItem[];
  cta: CtaBlock | null;
};

export type FormFieldConfig = {
  label: string;
  required: boolean;
  country?: string;
};

export type RequestFormBlock = {
  blockType: "requestForm";
  title: string;
  fields: {
    firstName: FormFieldConfig;
    lastName: FormFieldConfig;
    email: FormFieldConfig;
    phone: FormFieldConfig;
    package: FormFieldConfig;
    bestTime: FormFieldConfig;
  };
  packages: Array<{ title: string }>;
  terms: {
    id: string;
    text: string;
    required: boolean;
  };
  submit: {
    label: string;
    id?: string | null;
  };
  redirect?: {
    redirectType?: string;
    url?: string;
    slug?: string;
    openInNewTab?: boolean;
    head?: string;
    bodyTop?: string;
    bodyBottom?: string;
  };
  ui: {
    containerMaxWidth: number;
    inputHeightPx: number;
    borderColor: string;
    borderWidthPx: number;
    fontFamily: string;
  };
  formId: number | null;
};

export type GalleryImage = {
  id: string | number;
  url: string;
  alt: string;
};

export type CarouselBlock = {
  blockType: "carousel";
  images: GalleryImage[];
};

export type FloatingButtonBlock = {
  blockType: "floatingButton";
  label: string;
  href: string;
  icon: string;
  ctaId?: string | null;
};

export type FooterBlock = {
  blockType: "footer";
  text: string;
  variant: string;
};

export type SnippetsData = {
  head?: string;
  bodyTop?: string;
  bodyBottom?: string;
};

export type CMSBlock =
  | HeroBlock
  | IntroTextBlock
  | CardsBlock
  | RequestFormBlock
  | CarouselBlock
  | FloatingButtonBlock
  | FooterBlock;

export type PageData = {
  layout: CMSBlock[];
  meta: Record<string, unknown>;
  snippets: SnippetsData;
};
