import { TImageWithField } from "./Brand";
import { TImageUrls, TImageWithLink, TImageWithProductString } from "./Image";
import { TProduct } from "./Product";

export type TContent =
    | {
          data: TSectionMainBanner;
          type: "section_main_banner" | "section_main_banner_mobile";
      }
    | { data: TSectionSpecialOffer; type: "section_special_offer" }
    | {
          data: TSectionShowcase;
          type: "section_exclusive_collection";
      }
    | { data: TSectionShopByBrand; type: "section_shop_by_brand" }
    | { data: TSectionBlog; type: "section_blog" }
    | { data: TSectionTopBrands; type: "section_top_brands" };

export interface TSectionTopBrands {
    type: "section_top_brands";
    data: TSectionTopBrand;
}

export interface TSectionTopBrand {
    top_brands: TTopBrand[];
    title: string;
}

export interface TTopBrand {
    id: number;
    name: string;
    slug: string;
    content: [
        {
            type: "brand";
            data: {
                images: TImageWithField[];
            };
        }
    ];
    created_at: string;
    updated_at: string;
    products: TProduct[];
}

export interface TSectionBlog {
    title: string;
}

export interface TSectionShopByBrand {
    primary_banner: TImageWithProductString[];
    secondary_banner: TImageWithProductString[];
    title: string;
}

export interface TSectionSpecialOffer {
    title: string;
}

export interface TCollectionShowcase {
    image: number;
    name: string;
    products: TProduct[];
    urls: TImageUrls;
    image_preview: string;
    alt_text: string | null;
}

export interface TExclusiveCollection {
    collection: TCollectionShowcase[];
    title: string;
}

export interface TSectionShowcase {
    collection: TCollectionShowcase[];
    title: string;
}

export interface TSectionMainBanner {
    type: "section_main_banner" | "section_main_banner_mobile";
    data: TBanner;
}

export interface TBanner {
    banners: TImageWithLink[];
}

export interface TMainBannerData {
    banner_desktop: TImageWithLink[];
    banner_mobile: TImageWithLink[];
}

export interface TContentPopUpBanner {
    image: number | string;
    urls?: TImageUrls;
    alt_text?: string | null;
    image_preview?: string;
    title: string;
    description: string;
    button_label: string;
    button_link: string;
}

export interface TPopUpBanner {
    id: number;
    name: string;
    slug: string;
    content: [
        {
            type: "pop_up_banner";
            data: TContentPopUpBanner;
        }
    ];
    created_at: string;
    updated_at: string;
}
