import type {
  CategorizedFilters,
  SortItem,
} from "../components/destinationFilterAndSort"
import type { SortOption } from "../enums/destinationFilterAndSort"
import type { DestinationPagesHotelData } from "../hotel"
import type { DestinationCityListItem } from "../trpc/routers/contentstack/destinationCityPage"

interface Actions {
  updateActiveFiltersAndSort: (filters: string[], sort: string | null) => void
  setPendingSort: (sort: SortOption) => void
  togglePendingFilter: (filter: string) => void
  clearPendingFilters: () => void
  resetPendingValues: () => void
  setIsLoading: (isLoading: boolean) => void
}

export interface SubmitCallbackData {
  sort: SortOption
  defaultSort: SortOption
  filters: string[]
  basePath: string
}
export interface DestinationDataState {
  actions: Actions
  allCities: DestinationCityListItem[]
  activeCities: DestinationCityListItem[]
  allHotels: DestinationPagesHotelData[]
  activeHotels: DestinationPagesHotelData[]
  pendingSort: SortOption
  activeSort: SortOption
  defaultSort: SortOption
  pendingFilters: string[]
  activeFilters: string[]
  pendingHotelCount: number
  pendingCityCount: number
  allFilters: CategorizedFilters
  allFilterSlugs: string[]
  basePathnameWithoutFilters: string
  sortItems: SortItem[]
  isLoading: boolean
}

export interface InitialState
  extends Pick<DestinationDataState, "allHotels" | "allCities" | "sortItems"> {
  pathname: string
}
