import type { PeriodType, SupportedCurrencies } from '@entities' import type { HttpClient } from '@services' import type { ApiError, Response } from '@types' export type HousePeriodsIdInput = { currency?: SupportedCurrencies endDate: string startDate: string houseId: string } type Periods = { startAt: string endAt: string periodType: PeriodType minimumDuration: number houseId: number definitivePrice: boolean unitPriceWithoutOpCosts: number nightCount: number validMinimumDuration: boolean minimumPriceWithoutOpCosts: number priceWithoutOpCosts: number } export type HousePeriodsIdResponseData = { id: string allMinimumDurationValid: boolean endAt: string fullyCovered: boolean operationalCosts: null | number publicPrice: number startAt: string currency: SupportedCurrencies definitivePrices: boolean lcCommission: number ownerPriceWithoutOpCosts: string periodBookableOnline: boolean minimumPriceWithoutOpCosts: number periods: Periods[] } const getHousePeriodsById = (http: HttpClient) => { return { query: ({ currency = 'EUR', endDate, startDate, houseId, }: HousePeriodsIdInput): Promise< Response > => { return http.get( `v1/house_periods/${houseId}?currency=${currency}&end_at=${endDate}&start_at=${startDate}`, ) }, } } export default getHousePeriodsById