import type * as actionTypes from '../actionTypes.js'; import type { Action } from 'redux'; import type { BlackoutError, Brand, GetBrandsQuery } from '@farfetch/blackout-client'; import type { BrandsResultNormalized } from './state.types.js'; import type { NormalizedSchema } from 'normalizr'; type BrandsMeta = { hash: string; query?: GetBrandsQuery; }; type BrandNormalized = NormalizedSchema<{ brands: Record; }, Brand['id']>; type BrandsNormalized = NormalizedSchema<{ brands: Record; }, BrandsResultNormalized>; export interface ResetBrandsStateAction extends Action { type: typeof actionTypes.RESET_BRANDS_STATE; } export interface FetchBrandFailureAction extends Action { meta: { brandId: Brand['id']; }; payload: { error: BlackoutError; }; type: typeof actionTypes.FETCH_BRAND_FAILURE; } export interface FetchBrandRequestAction extends Action { meta: { brandId: Brand['id']; }; type: typeof actionTypes.FETCH_BRAND_REQUEST; } export interface FetchBrandSuccessAction extends Action { meta: { brandId: Brand['id']; }; payload: BrandNormalized; type: typeof actionTypes.FETCH_BRAND_SUCCESS; } export type FetchBrandAction = FetchBrandFailureAction | FetchBrandRequestAction | FetchBrandSuccessAction; export interface FetchBrandsFailureAction extends Action { meta: BrandsMeta; payload: { error: BlackoutError; }; type: typeof actionTypes.FETCH_BRANDS_FAILURE; } export interface FetchBrandsRequestAction extends Action { meta: BrandsMeta; type: typeof actionTypes.FETCH_BRANDS_REQUEST; } export interface FetchBrandsSuccessAction extends Action { meta: BrandsMeta; payload: BrandsNormalized; type: typeof actionTypes.FETCH_BRANDS_SUCCESS; } export type FetchBrandsAction = FetchBrandsFailureAction | FetchBrandsRequestAction | FetchBrandsSuccessAction | ResetBrandsStateAction; export {};