import {
	SET_SITES,
	SET_RECENT_SITES,
	SET_SITES_BY_LANG,
	SET_CURRENT_SITE_INFO,
	SET_CURRENT_SITE_PAGES,
	SET_ALL_SITE_PAGES,
	SET_FILTER,
	SET_TOTAL_ITEMS,
	SET_CURRENT_SITE_LANGUAGES,
	SET_INITIAL_VALUES,
	SET_SAVED_SITE_INFO,
	SET_CURRENT_SITE_ERROR_PAGES,
	SET_CONTENT_FILTERS,
	SET_SITES_TOTAL_ITEMS,
	SET_CONFIG,
	SET_CURRENT_SEARCH,
	SET_THEME_ELEMENTS,
	SET_IS_SITES_LOADING,
	SET_ALL_SITES,
} from "./constants";
import { IQueryValue, ISite, ISiteListConfig, IThemeElements } from "@ax/types";

export interface ISetFilter {
	type: typeof SET_FILTER;
	payload: { currentFilter: string | null };
}

export interface ISetSitesAction {
	type: typeof SET_SITES;
	payload: { sites: ISite[] };
}

export interface ISetRecentSitesAction {
	type: typeof SET_RECENT_SITES;
	payload: { recentSites: ISite[] };
}

export interface ISetSitesTotalItems {
	type: typeof SET_SITES_TOTAL_ITEMS;
	payload: { sitesTotalItems: number };
}

export interface ISetSitesByLangAction {
	type: typeof SET_SITES_BY_LANG;
	payload: { sitesByLang: ISite[] };
}

export interface ISetCurrentSiteInfoAction {
	type: typeof SET_CURRENT_SITE_INFO;
	payload: { currentSiteInfo: ISite | null };
}

export interface ISetCurrentSitePagesAction {
	type: typeof SET_CURRENT_SITE_PAGES;
	payload: { currentSitePages: any }; // FIXME: establecer type
}

export interface ISetAllSitePagesAction {
	type: typeof SET_ALL_SITE_PAGES;
	payload: { allSitePages: any }; // FIXME: establecer type
}

export interface ISetTotalItems {
	type: typeof SET_TOTAL_ITEMS;
	payload: { totalItems: number };
}

export interface ISetCurrentSiteLanguagesAction {
	type: typeof SET_CURRENT_SITE_LANGUAGES;
	payload: { currentSiteLanguages: any[] }; // FIXME: establecer type
}

export interface ISetInitialValuesAction {
	type: typeof SET_INITIAL_VALUES;
	payload: { initialValues: any };
}

export interface ISetSavedSiteInfoAction {
	type: typeof SET_SAVED_SITE_INFO;
	payload: { savedSiteInfo: ISite };
}

export interface ISetCurrentSiteErrorPages {
	type: typeof SET_CURRENT_SITE_ERROR_PAGES;
	payload: { currentSiteErrorPages: number[] };
}

export interface ISetContentFilters {
	type: typeof SET_CONTENT_FILTERS;
	payload: { contentFilters: Record<string, IQueryValue[]> | null };
}

export interface ISetConfig {
	type: typeof SET_CONFIG;
	payload: { config: ISiteListConfig };
}

export interface ISetCurrentSearch {
	type: typeof SET_CURRENT_SEARCH;
	payload: { currentSearch: string };
}

export interface ISetThemeElements {
	type: typeof SET_THEME_ELEMENTS;
	payload: { themeElements: IThemeElements | null };
}

export interface ISetIsSitesLoading {
	type: typeof SET_IS_SITES_LOADING;
	payload: { isSitesLoading: boolean };
}

export interface ISetAllSitesAction {
	type: typeof SET_ALL_SITES;
	payload: { allSites: ISite[] };
}

export type SitesActionsCreators = ISetSitesAction & ISetCurrentSiteInfoAction;
