{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://dashremix.com/spec/rental/1.2.0/rental@1.schema.json",
 "title": "rental@1 v1.2.0",
 "description": "One property per table (an array of rows). Generated from schema.sql by spec/build.py. Extension tables (x_<owner>_*) belong to forks and board-derived tables (d_*) to the board that rebuilds them; both are allowed as additional properties.",
 "type": "object",
 "properties": {
  "meta": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "key": {
      "type": [
       "string",
       "null"
      ]
     },
     "value": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [],
    "additionalProperties": false
   }
  },
  "listings": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "listing_id": {
      "type": "string"
     },
     "property_id": {
      "type": "string"
     },
     "name": {
      "type": [
       "string",
       "null"
      ]
     },
     "channel_ids": {
      "type": [
       "string",
       "null"
      ]
     },
     "bedrooms": {
      "type": [
       "integer",
       "null"
      ]
     },
     "active_from": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "active_to": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "currency": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^[A-Z]{3}$"
     },
     "tz": {
      "type": [
       "string",
       "null"
      ]
     },
     "city": {
      "type": [
       "string",
       "null"
      ]
     },
     "country": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^[A-Z]{2}$"
     },
     "source": {
      "type": [
       "string",
       "null"
      ]
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     },
     "imported_at": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?Z$"
     },
     "unit_code": {
      "type": [
       "string",
       "null"
      ]
     },
     "max_guests": {
      "type": [
       "integer",
       "null"
      ]
     }
    },
    "required": [
     "listing_id",
     "property_id"
    ],
    "additionalProperties": false
   }
  },
  "reservations": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "reservation_id": {
      "type": "string"
     },
     "listing_id": {
      "type": "string"
     },
     "channel": {
      "type": "string",
      "enum": [
       "airbnb",
       "vrbo",
       "booking",
       "direct",
       "other"
      ]
     },
     "status": {
      "type": "string",
      "enum": [
       "confirmed",
       "cancelled",
       "no_show",
       "pending"
      ]
     },
     "booked_at": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?Z$"
     },
     "booked_on": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "cancelled_on": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "check_in": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "check_out": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "nights": {
      "type": "integer"
     },
     "guests": {
      "type": [
       "integer",
       "null"
      ]
     },
     "accommodation": {
      "type": [
       "number",
       "null"
      ]
     },
     "cleaning_fee": {
      "type": [
       "number",
       "null"
      ]
     },
     "other_fees": {
      "type": [
       "number",
       "null"
      ]
     },
     "guest_service_fee": {
      "type": [
       "number",
       "null"
      ]
     },
     "host_fee": {
      "type": [
       "number",
       "null"
      ]
     },
     "taxes_collected": {
      "type": [
       "number",
       "null"
      ]
     },
     "taxes_remitted_by_channel": {
      "type": [
       "number",
       "null"
      ]
     },
     "gross": {
      "type": [
       "number",
       "null"
      ]
     },
     "payout": {
      "type": [
       "number",
       "null"
      ]
     },
     "currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$"
     },
     "source": {
      "type": "string"
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     },
     "imported_at": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?Z$"
     },
     "guest_key": {
      "type": [
       "string",
       "null"
      ]
     },
     "checkin_status": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "not_started",
       "started",
       "completed",
       null
      ]
     }
    },
    "required": [
     "reservation_id",
     "listing_id",
     "channel",
     "status",
     "check_in",
     "check_out",
     "nights",
     "currency",
     "source"
    ],
    "additionalProperties": false
   }
  },
  "adjustments": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "adjustment_id": {
      "type": "string"
     },
     "reservation_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "listing_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "kind": {
      "type": "string",
      "enum": [
       "refund",
       "alteration",
       "resolution",
       "cancellation_fee",
       "penalty",
       "other"
      ]
     },
     "amount": {
      "type": "number"
     },
     "currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$"
     },
     "description": {
      "type": [
       "string",
       "null"
      ]
     },
     "source": {
      "type": "string"
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     },
     "imported_at": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "adjustment_id",
     "date",
     "kind",
     "amount",
     "currency",
     "source"
    ],
    "additionalProperties": false
   }
  },
  "payouts": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "payout_id": {
      "type": "string"
     },
     "date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "amount": {
      "type": "number"
     },
     "currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$"
     },
     "reservation_ids": {
      "type": [
       "string",
       "null"
      ]
     },
     "channel": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "airbnb",
       "vrbo",
       "booking",
       "direct",
       "other",
       null
      ]
     },
     "reference": {
      "type": [
       "string",
       "null"
      ]
     },
     "source": {
      "type": "string"
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     },
     "imported_at": {
      "type": [
       "string",
       "null"
      ]
     },
     "status": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "received",
       "expected",
       "overdue",
       "cancelled",
       null
      ]
     }
    },
    "required": [
     "payout_id",
     "date",
     "amount",
     "currency",
     "source"
    ],
    "additionalProperties": false
   }
  },
  "availability": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "listing_id": {
      "type": "string"
     },
     "date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "state": {
      "type": "string",
      "enum": [
       "available",
       "booked",
       "owner_block",
       "blocked"
      ]
     },
     "source": {
      "type": [
       "string",
       "null"
      ]
     },
     "price": {
      "type": [
       "number",
       "null"
      ]
     },
     "min_stay": {
      "type": [
       "integer",
       "null"
      ]
     }
    },
    "required": [
     "listing_id",
     "date",
     "state"
    ],
    "additionalProperties": false
   }
  },
  "expenses": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "expense_id": {
      "type": "string"
     },
     "date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "property_id": {
      "type": "string"
     },
     "listing_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "category": {
      "type": "string"
     },
     "amount": {
      "type": "number"
     },
     "currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$"
     },
     "description": {
      "type": [
       "string",
       "null"
      ]
     },
     "txn_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "source": {
      "type": "string"
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     },
     "imported_at": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "expense_id",
     "date",
     "property_id",
     "category",
     "amount",
     "currency",
     "source"
    ],
    "additionalProperties": false
   }
  },
  "reviews": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "review_id": {
      "type": "string"
     },
     "listing_id": {
      "type": "string"
     },
     "reservation_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "rating": {
      "type": [
       "number",
       "null"
      ]
     },
     "channel": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "airbnb",
       "vrbo",
       "booking",
       "direct",
       "other",
       null
      ]
     },
     "source": {
      "type": [
       "string",
       "null"
      ]
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     },
     "needs_reply": {
      "type": [
       "integer",
       "null"
      ]
     },
     "reply_status": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "unanswered",
       "drafted",
       "replied",
       null
      ]
     }
    },
    "required": [
     "review_id",
     "listing_id",
     "date"
    ],
    "additionalProperties": false
   }
  },
  "fx_rates": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "ccy": {
      "type": "string",
      "pattern": "^[A-Z]{3}$"
     },
     "base_per_unit": {
      "type": "number"
     },
     "source": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "date",
     "ccy",
     "base_per_unit"
    ],
    "additionalProperties": false
   }
  },
  "properties": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "property_id": {
      "type": "string"
     },
     "name": {
      "type": [
       "string",
       "null"
      ]
     },
     "tz": {
      "type": [
       "string",
       "null"
      ]
     },
     "currency": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^[A-Z]{3}$"
     },
     "opened_on": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "source": {
      "type": [
       "string",
       "null"
      ]
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "property_id"
    ],
    "additionalProperties": false
   }
  },
  "reservation_units": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "reservation_id": {
      "type": "string"
     },
     "listing_id": {
      "type": "string"
     },
     "start_date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "end_date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "source": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "reservation_id",
     "listing_id",
     "start_date",
     "end_date"
    ],
    "additionalProperties": false
   }
  },
  "cleanings": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "cleaning_id": {
      "type": "string"
     },
     "listing_id": {
      "type": "string"
     },
     "date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "action": {
      "type": "string",
      "enum": [
       "status",
       "arrival",
       "checkout",
       "courtesy"
      ]
     },
     "status": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "clean",
       "inspection",
       "dirty",
       "unknown",
       null
      ]
     },
     "reservation_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "updated_at": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?Z$"
     },
     "source": {
      "type": [
       "string",
       "null"
      ]
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "cleaning_id",
     "listing_id",
     "date",
     "action"
    ],
    "additionalProperties": false
   }
  },
  "tasks": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "task_id": {
      "type": "string"
     },
     "property_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "listing_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "reservation_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "kind": {
      "type": [
       "string",
       "null"
      ]
     },
     "status": {
      "type": "string",
      "enum": [
       "todo",
       "in_progress",
       "blocked",
       "done"
      ]
     },
     "priority": {
      "type": [
       "string",
       "null"
      ]
     },
     "due_on": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "done_on": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "archived": {
      "type": [
       "integer",
       "null"
      ]
     },
     "source": {
      "type": "string"
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "task_id",
     "status",
     "source"
    ],
    "additionalProperties": false
   }
  },
  "guest_registrations": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "registration_id": {
      "type": "string"
     },
     "reservation_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "authority": {
      "type": "string",
      "enum": [
       "sire",
       "tra",
       "ses",
       "alloggiati",
       "siba",
       "other"
      ]
     },
     "kind": {
      "type": [
       "string",
       "null"
      ]
     },
     "event_date": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "due_at": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?Z$"
     },
     "status": {
      "type": "string",
      "enum": [
       "pending",
       "filed",
       "failed",
       "cancelled",
       "not_required"
      ]
     },
     "status_raw": {
      "type": [
       "string",
       "null"
      ]
     },
     "filed_at": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?Z$"
     },
     "attempts": {
      "type": [
       "integer",
       "null"
      ]
     },
     "source": {
      "type": "string"
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "registration_id",
     "authority",
     "status",
     "source"
    ],
    "additionalProperties": false
   }
  },
  "filing_incidents": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "incident_id": {
      "type": "string"
     },
     "authority": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "sire",
       "tra",
       "ses",
       "alloggiati",
       "siba",
       "other",
       null
      ]
     },
     "kind": {
      "type": "string"
     },
     "status": {
      "type": "string"
     },
     "opened_at": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?Z$"
     },
     "closed_at": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?Z$"
     },
     "source": {
      "type": "string"
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "incident_id",
     "kind",
     "status",
     "source"
    ],
    "additionalProperties": false
   }
  },
  "invoices": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "invoice_id": {
      "type": "string"
     },
     "kind": {
      "type": "string"
     },
     "status": {
      "type": "string",
      "enum": [
       "draft",
       "ready",
       "sending",
       "accepted",
       "rejected",
       "failed",
       "voided",
       "unknown"
      ]
     },
     "issue_date": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "reservation_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "total": {
      "type": [
       "number",
       "null"
      ]
     },
     "currency": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^[A-Z]{3}$"
     },
     "source": {
      "type": "string"
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "invoice_id",
     "kind",
     "status",
     "source"
    ],
    "additionalProperties": false
   }
  },
  "ledger_months": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "month": {
      "type": "string"
     },
     "currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$"
     },
     "revenue": {
      "type": [
       "number",
       "null"
      ]
     },
     "costs": {
      "type": [
       "number",
       "null"
      ]
     },
     "net": {
      "type": [
       "number",
       "null"
      ]
     },
     "status": {
      "type": [
       "string",
       "null"
      ]
     },
     "source": {
      "type": "string"
     }
    },
    "required": [
     "month",
     "currency",
     "source"
    ],
    "additionalProperties": false
   }
  },
  "cancel_reasons": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "period_from": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "period_to": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "category": {
      "type": "string"
     },
     "label": {
      "type": [
       "string",
       "null"
      ]
     },
     "count": {
      "type": "integer"
     },
     "nights": {
      "type": [
       "integer",
       "null"
      ]
     },
     "source": {
      "type": "string"
     }
    },
    "required": [
     "period_from",
     "period_to",
     "category",
     "count",
     "source"
    ],
    "additionalProperties": false
   }
  },
  "review_scores": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "review_id": {
      "type": "string"
     },
     "category": {
      "type": "string",
      "enum": [
       "cleanliness",
       "accuracy",
       "communication",
       "check_in",
       "location",
       "value"
      ]
     },
     "score": {
      "type": "number"
     },
     "source": {
      "type": [
       "string",
       "null"
      ]
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "review_id",
     "category",
     "score"
    ],
    "additionalProperties": false
   }
  },
  "import_issues": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "issue_id": {
      "type": "string"
     },
     "severity": {
      "type": "string",
      "enum": [
       "info",
       "warn",
       "error"
      ]
     },
     "kind": {
      "type": "string"
     },
     "file": {
      "type": [
       "string",
       "null"
      ]
     },
     "line": {
      "type": [
       "integer",
       "null"
      ]
     },
     "detail": {
      "type": "string"
     },
     "handling": {
      "type": "string"
     },
     "source": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "issue_id",
     "severity",
     "kind",
     "detail",
     "handling"
    ],
    "additionalProperties": false
   }
  },
  "overrides": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "override_id": {
      "type": "string"
     },
     "target": {
      "type": "string"
     },
     "field": {
      "type": [
       "string",
       "null"
      ]
     },
     "old_value": {
      "type": [
       "string",
       "null"
      ]
     },
     "new_value": {
      "type": [
       "string",
       "null"
      ]
     },
     "reason": {
      "type": "string"
     },
     "evidence": {
      "type": [
       "string",
       "null"
      ]
     },
     "author": {
      "type": [
       "string",
       "null"
      ]
     },
     "created_at": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "override_id",
     "target",
     "reason"
    ],
    "additionalProperties": false
   }
  },
  "annotations": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "annotation_id": {
      "type": "string"
     },
     "target": {
      "type": "string"
     },
     "kind": {
      "type": "string"
     },
     "body": {
      "type": "string"
     },
     "author": {
      "type": [
       "string",
       "null"
      ]
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     },
     "created_at": {
      "type": [
       "string",
       "null"
      ]
     },
     "data_hash": {
      "type": [
       "string",
       "null"
      ]
     },
     "status": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "annotation_id",
     "target",
     "kind",
     "body"
    ],
    "additionalProperties": false
   }
  },
  "metric_registry": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "metric_id": {
      "type": "string"
     },
     "version": {
      "type": [
       "integer",
       "null"
      ]
     },
     "unit": {
      "type": [
       "string",
       "null"
      ]
     },
     "params": {
      "type": [
       "string",
       "null"
      ]
     },
     "description": {
      "type": [
       "string",
       "null"
      ]
     },
     "sql": {
      "type": [
       "string",
       "null"
      ]
     },
     "test": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "metric_id"
    ],
    "additionalProperties": false
   }
  }
 },
 "required": [
  "meta",
  "listings",
  "reservations"
 ],
 "patternProperties": {
  "^x_[a-z0-9_]+$": {
   "type": "array"
  },
  "^d_[a-z0-9_]+$": {
   "type": "array"
  }
 },
 "additionalProperties": false
}
