export type PriceValue = number | { checkin_days: Record<string, number> };

export type UnitPoints = Record<string, any> & {
  short_break_3?: Record<string, PriceValue>;
  short_break_4?: Record<string, PriceValue>;
  nights_3?: Record<string, PriceValue>;
  nights_4?: Record<string, PriceValue>;
  nights_6?: Record<string, PriceValue>;
  daily?: Record<string, PriceValue>;
  weekly?: Record<string, PriceValue>;
  accept_peaks?: boolean;
  accept_early_bird?: boolean;
  accept_late_break?: boolean;
};

export type RoleCondition = string | { and: string[]; negation?: boolean };

export interface OverrideBlock {
  roles?: RoleCondition[];
  settings?: Record<string, any>;
}

export interface TravelRule {
  id: string;
  resort?: string;
  unit_code: string;
  alias_target_unit_code?: string;
  rule_id?: string;
  min_nights?: number;
  max_nights?: number;
  max_occ?: number;
  confirm_from?: string;
  confirm_to?: string;
  is_active?: boolean;
  publish_mode?: "DRAFT" | "PUBLISHED";
  sort_order?: number;
  roles?: RoleCondition[];
  travel_between?: [string, string][];
  unit_points?: UnitPoints;
  override?: Record<string, OverrideBlock>;
  terms_conditions?: string;
  booking_caption?: string;
  expose_option?: boolean;
  with_checkin_day?: boolean;
  hot_deal_type?: number;
  more_rules?: any[];
  [key: string]: any;
}

export interface TravelRuleListResult {
  items: TravelRule[];
  total: number;
  page: number;
  limit: number;
}
