export interface StorefrontImage {
  src: string;
  alt: string;
}

export interface StorefrontTerm {
  id: number;
  name: string;
  slug: string;
}

export interface StorefrontMenuItem {
  id: string;
  label: string;
  href: string;
}

export interface StorefrontHeaderCategoryChild {
  id: number;
  name: string;
  slug: string;
  href: string;
  image: StorefrontImage | null;
}

export interface StorefrontHeaderCategory {
  id: number;
  name: string;
  slug: string;
  href: string;
  children: StorefrontHeaderCategoryChild[];
}

export interface StorefrontSearchSuggestion {
  id: number;
  name: string;
  slug: string;
  href: string;
  price: string;
  image: StorefrontImage | null;
  brand: StorefrontTerm | null;
}

export interface StorefrontCategoryCard {
  id: number;
  name: string;
  slug: string;
  href: string;
  count: number;
  image: StorefrontImage | null;
}

export interface StorefrontFeaturedBanner {
  id: number;
  title: string;
  image: StorefrontImage | null;
  href?: string;
}

export interface StorefrontFeatureGridBanner {
  id: string;
  title: string;
  image: StorefrontImage | null;
  href?: string;
}

export interface StorefrontProductCard {
  id: number;
  slug: string;
  name: string;
  href: string;
  type: string;
  shortDescription: string;
  featuredImage: StorefrontImage | null;
  category: StorefrontTerm | null;
  brand: StorefrontTerm | null;
  price: string;
  regularPrice?: string;
  salePrice?: string;
  lowestPrice30d?: string;
  isOnSale: boolean;
  isInStock: boolean;
}

export interface StorefrontProductVariationAttribute {
  key: string;
  label: string;
  value: string;
  slug?: string;
}

export interface StorefrontProductVariation {
  id: number;
  price: string;
  regularPrice?: string;
  salePrice?: string;
  lowestPrice30d?: string;
  isOnSale: boolean;
  isInStock: boolean;
  attributes: StorefrontProductVariationAttribute[];
}

export interface StorefrontFilterGroup {
  id: string;
  label: string;
  type: "checkbox";
  options: Array<{
    id: string;
    label: string;
    count?: number;
  }>;
}

export interface StorefrontProductTabs {
  descriptionHtml: string;
  technicalDetailsHtml: string;
  downloadsHtml: string;
  sizeChartHtml: string;
}

export interface StorefrontArchivePage {
  title: string;
  description: string;
  totalResults: number;
  products: StorefrontProductCard[];
  filters: StorefrontFilterGroup[];
  currentPage: number;
  totalPages: number;
  priceRange: {
    min: number;
    max: number;
  } | null;
}

export interface StorefrontProductDetail extends StorefrontProductCard {
  description: string;
  gallery: StorefrontImage[];
  breadcrumbs: Array<{
    label: string;
    href?: string;
  }>;
  attributes: Array<{
    label: string;
    value: string;
  }>;
  variations: StorefrontProductVariation[];
  relatedProducts: StorefrontProductCard[];
  tabs: StorefrontProductTabs;
}

export interface StorefrontCartItemVariation {
  label: string;
  value: string;
}

export interface StorefrontCartItem {
  key: string;
  productId: number;
  variationId?: number;
  name: string;
  href: string;
  label: string;
  image: StorefrontImage | null;
  quantity: number;
  variation: StorefrontCartItemVariation[];
  unitPrice: string;
  total: string;
  regularPrice?: string;
  isOnSale: boolean;
}

export interface StorefrontCart {
  items: StorefrontCartItem[];
  itemCount: number;
  subtotal: string;
  total: string;
  isEmpty: boolean;
}

export interface StorefrontWishlistItem {
  id: number;
  productId?: number;
  variationId?: number;
  slug: string;
  type: string;
  name: string;
  href: string;
  label: string;
  image: StorefrontImage | null;
  price: string;
  regularPrice?: string;
  salePrice?: string;
}

export interface StorefrontWishlist {
  items: StorefrontWishlistItem[];
  itemCount: number;
  isEmpty: boolean;
}

export interface StorefrontCheckoutAddress {
  firstName: string;
  lastName: string;
  address1: string;
  address2: string;
  city: string;
  postcode: string;
  country: string;
  email: string;
  phone: string;
}

export interface StorefrontCheckoutPaymentMethod {
  id: string;
  label: string;
}

export interface StorefrontCheckoutRate {
  id: string;
  label: string;
  description?: string;
  price: string;
  selected: boolean;
}

export interface StorefrontCheckoutShippingPackage {
  id: number;
  label: string;
  rates: StorefrontCheckoutRate[];
}

export interface StorefrontCheckoutState {
  cart: StorefrontCart;
  billingAddress: StorefrontCheckoutAddress;
  shippingAddress: StorefrontCheckoutAddress;
  shippingPackages: StorefrontCheckoutShippingPackage[];
  paymentMethods: StorefrontCheckoutPaymentMethod[];
  selectedPaymentMethod?: string;
  needsShipping: boolean;
  needsPayment: boolean;
}

export interface StorefrontCheckoutStep {
  id: string;
  label: string;
  description: string;
  isActive: boolean;
}

export interface StorefrontAccountSession {
  email: string;
  firstName: string;
  lastName: string;
  phone?: string;
  address1?: string;
  postcode?: string;
  city?: string;
  companyName?: string;
  oib?: string;
  companyAddress?: string;
  accountType: "person" | "company";
}

export interface StorefrontOrderSummaryItem {
  id: number;
  name: string;
  quantity: number;
  unitPrice?: string;
  taxTotal?: string;
  total: string;
  meta: Array<{
    label: string;
    value: string;
  }>;
}

export interface StorefrontOrderSummary {
  id: number;
  orderKey: string;
  number: string;
  status: string;
  paymentMethod: string;
  shippingMethod: string;
  billingAddress: {
    firstName: string;
    lastName: string;
    company?: string;
    address1: string;
    city: string;
    postcode: string;
    email: string;
    phone: string;
    oib?: string;
  };
  shippingAddress: {
    firstName: string;
    lastName: string;
    address1: string;
    city: string;
    postcode: string;
  };
  items: StorefrontOrderSummaryItem[];
  subtotal: string;
  taxTotal?: string;
  shippingTotal: string;
  total: string;
}

export interface StorefrontBlogPostCard {
  id: number;
  slug: string;
  href: string;
  title: string;
  excerpt: string;
  publishedAt: string;
  category: StorefrontTerm | null;
  image: StorefrontImage | null;
}

export interface StorefrontBlogArchivePage {
  title: string;
  query: string;
  currentCategorySlug: string;
  totalResults: number;
  currentPage: number;
  totalPages: number;
  categories: StorefrontTerm[];
  posts: StorefrontBlogPostCard[];
}

export interface StorefrontBlogPost extends StorefrontBlogPostCard {
  authorName: string;
  authorAvatar: StorefrontImage | null;
  contentHtml: string;
  relatedPosts: StorefrontBlogPostCard[];
}
