/** * Calendar and listing-related types */ import { ChannelType, ChannelTypeParam, ListingId } from './common.js'; /** * Listing restrictions */ export interface ListingRestrictions { /** Reservations for check-in on this date are not allowed */ closed_on_arrival?: boolean; /** Reservations for check-out on this date are not allowed */ closed_on_departure?: boolean; /** Min stay for reservations including this date */ min_stay_on_arrival?: number; /** Max stay for reservations including this date */ max_stay_on_arrival?: number; /** Min stay through (booking.com, agoda) */ min_stay_through?: number; /** Max stay through (booking.com) */ max_stay_through?: number; /** Min advance reservation in format 'xDxH' (booking.com) */ min_advance_reservation?: string; /** Max advance reservation in format 'xDxH' (booking.com) */ max_advance_reservation?: string; /** Exact stay required for check-in on this date (booking.com) */ exact_stay_on_arrival?: number; } /** * Calendar day information */ export interface CalendarDay { /** The date (YYYY-MM-DD) */ date: string; /** The price for the date */ price: number; /** The inventory for the date */ inventory: number; /** Restrictions for the date */ restrictions?: ListingRestrictions; } /** * Listing calendar */ export interface ListingCalendar { /** The listing ID */ listing_id: ListingId; /** The channel type */ channel_type: ChannelType; /** Calendar data */ calendar: CalendarDay[]; } /** * Listing reference for calendar query */ export interface ListingReference { /** Channel type */ channel_type: ChannelTypeParam; /** Listing ID */ listing_id: ListingId; } /** * Calendar query parameters */ export interface CalendarQueryParams { /** Start date (YYYY-MM-DD, within 1 year from now) */ start_date: string; /** End date (YYYY-MM-DD, within 3 years from now) */ end_date: string; /** List of listings to query */ listings: ListingReference[]; } /** * Calendar response data */ export interface CalendarData { /** List of listing calendars */ listings: ListingCalendar[]; } /** * Inventory update item */ export interface InventoryUpdate { /** Start date (YYYY-MM-DD) */ start_date: string; /** End date (YYYY-MM-DD, within 3 years from now) */ end_date: string; /** Number of available units */ inventory: number; } /** * Update listing inventories parameters */ export interface UpdateListingInventoriesParams { /** Channel type */ channel_type: ChannelTypeParam; /** Listing ID */ listing_id: ListingId; /** Inventory updates */ inventories: InventoryUpdate[]; } /** * Price update item */ export interface PriceUpdate { /** Start date (YYYY-MM-DD) */ start_date: string; /** End date (YYYY-MM-DD, within 3 years from now) */ end_date: string; /** Price (e.g., 100 = 100 USD, not cents) */ price: number; } /** * Update listing prices parameters */ export interface UpdateListingPricesParams { /** Channel type */ channel_type: ChannelTypeParam; /** Listing ID */ listing_id: ListingId; /** Price updates */ prices: PriceUpdate[]; } /** * Restriction update item */ export interface RestrictionUpdate extends ListingRestrictions { /** Start date (YYYY-MM-DD) */ start_date: string; /** End date (YYYY-MM-DD, within 3 years from now) */ end_date: string; } /** * Update listing restrictions parameters */ export interface UpdateListingRestrictionsParams { /** Channel type */ channel_type: ChannelTypeParam; /** Listing ID */ listing_id: ListingId; /** Restriction updates */ restrictions: RestrictionUpdate[]; }