{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "AlayaCare Accounting API Schemas",
  "definitions": {
    "InvoicingModelField": {
      "type": "string",
      "description": "Invoicing Model used by the Funder\n\n* batched -> All Client Visits roll up to 1 Invoice for the Payor\n* funder_individual -> One Invoice per Client is sent to the Payor\n* individual_invoices -> One Invoice per Client is sent to the Client or Billing Contact\n* hcp -> invoicing_model specific for Australian Home Care Packages program\n* mecicaid -> Each Date of Service or Visit creates 1 Invoice\n* ccac -> CHRIS/HPG/LHIN invoicing model - Each Visit creates 1 Invoice.\n          All Invoices for 1 payor are batched into 1 submission to the payor\n",
      "enum": [
        "batched",
        "funder_individual",
        "individual_invoices",
        "ccac",
        "medicaid",
        "hcp",
        "ndis"
      ]
    },
    "FunderTypeField": {
      "type": "string",
      "description": "Provided for backwards compatibility, equivalent to `invoicing_model`\nbut mapping different values\n\nThe following three mappings are different:\n* client_individual -> individual_invoices\n* electronic_billing -> medicaid\n* funder_batched -> batched\n\nThe following mappings remain the same:\n* funder_individual\n* ccac\n* hcp\n",
      "enum": [
        "funder_individual",
        "client_individual",
        "electronic_billing",
        "funder_batched",
        "ccac",
        "hcp"
      ]
    },
    "FunderCreateSchema": {
      "anyOf": [
        {
          "$ref": "#/components/schemas/FunderCommonCreateSchema"
        },
        {
          "$ref": "#/components/schemas/FunderElectronicBillingCreateSchema"
        },
        {
          "$ref": "#/components/schemas/FunderHcpCreateSchema"
        },
        {
          "$ref": "#/components/schemas/FunderCcacCreateSchema"
        }
      ]
    },
    "FunderUpdateSchema": {
      "anyOf": [
        {
          "$ref": "#/components/schemas/FunderCommonUpdateSchema"
        },
        {
          "$ref": "#/components/schemas/FunderElectronicBillingUpdateSchema"
        },
        {
          "$ref": "#/components/schemas/FunderHcpUpdateSchema"
        },
        {
          "$ref": "#/components/schemas/FunderCcacUpdateSchema"
        }
      ]
    },
    "FunderBaseCreateSchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/FunderBaseUpdateSchema"
        },
        {
          "type": "object",
          "properties": {
            "branch_id": {
              "type": "integer",
              "description": "The ID of the branch to which this funder belongs",
              "example": 1,
              "minimum": 1
            }
          }
        }
      ]
    },
    "FunderBaseUpdateSchema": {
      "type": "object",
      "description": "Fields shared by create requests for all invoicing_model types",
      "properties": {
        "code": {
          "type": "string",
          "example": "Code"
        },
        "description": {
          "type": "string",
          "example": "Description"
        },
        "gl_asset": {
          "$ref": "#/components/schemas/LinkedEntitySchema"
        },
        "gl_bank": {
          "$ref": "#/components/schemas/LinkedEntitySchema"
        },
        "holiday_multiplier": {
          "type": "number",
          "example": "1.00"
        },
        "invoicing_model": {
          "$ref": "#/components/schemas/InvoicingModelField"
        },
        "name": {
          "type": "string",
          "example": "Name"
        },
        "profile": {
          "$ref": "#/components/schemas/ProfileSchema"
        },
        "taxes": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/FunderTaxesItemSchema"
          }
        },
        "gl_receivables_cost_centre": {
          "$ref": "#/components/schemas/CostCentreSchema"
        },
        "gl_bank_cost_centre": {
          "$ref": "#/components/schemas/CostCentreSchema"
        },
        "line_item_limit": {
          "type": "number",
          "example": 76
        }
      }
    },
    "FunderCommonUpdateFieldsSchema": {
      "type": "object",
      "properties": {
        "allow_paypal_payment": {
          "type": "boolean",
          "example": false
        },
        "agency_profile": {
          "type": "string",
          "example": "Agency profile"
        },
        "billing_contact": {
          "type": "string",
          "example": "Billing contact"
        },
        "billing_adjustment_period": {
          "type": "integer",
          "example": 30
        },
        "organization_name": {
          "type": "string",
          "example": "Organization name"
        },
        "organization_code": {
          "type": "string",
          "example": "Organization code"
        },
        "billing_frequency": {
          "type": "string",
          "example": "weekly",
          "enum": [
            "no_frequency",
            "weekly",
            "calendar_month"
          ]
        }
      }
    },
    "FunderCommonCreateSchema": {
      "description": "Update requests for 'batched', 'funder_individual' and 'individual_invoices' invoicing model types",
      "allOf": [
        {
          "$ref": "#/components/schemas/FunderBaseCreateSchema"
        },
        {
          "$ref": "#/components/schemas/FunderCommonUpdateFieldsSchema"
        }
      ]
    },
    "FunderCommonUpdateSchema": {
      "description": "Update requests for 'batched', 'funder_individual' and 'individual_invoices' invoicing model types",
      "allOf": [
        {
          "$ref": "#/components/schemas/FunderBaseUpdateSchema"
        },
        {
          "$ref": "#/components/schemas/FunderCommonUpdateFieldsSchema"
        }
      ]
    },
    "FunderCcacUpdateFieldsSchema": {
      "type": "object",
      "properties": {
        "ccac_code": {
          "type": "string",
          "example": "GT"
        },
        "ccac_name": {
          "type": "string",
          "example": "Central CCAC"
        },
        "organization_code": {
          "type": "string",
          "example": "org_code"
        },
        "organization_name": {
          "type": "string",
          "example": "Green Cross Inc."
        },
        "billing_frequency": {
          "type": "string",
          "example": "weekly",
          "enum": [
            "none",
            "weekly",
            "calendar_month"
          ]
        },
        "file_name_prefix": {
          "type": "string",
          "example": "GT"
        }
      }
    },
    "FunderCcacCreateSchema": {
      "description": "Create requests for Funders with 'ccac' invoicing_model type",
      "allOf": [
        {
          "$ref": "#/components/schemas/FunderBaseCreateSchema"
        },
        {
          "$ref": "#/components/schemas/FunderCcacUpdateFieldsSchema"
        }
      ]
    },
    "FunderCcacUpdateSchema": {
      "description": "Create requests for Funders with 'ccac' invoicing_model type",
      "allOf": [
        {
          "$ref": "#/components/schemas/FunderBaseUpdateSchema"
        },
        {
          "$ref": "#/components/schemas/FunderCcacUpdateFieldsSchema"
        }
      ]
    },
    "FunderElectronicBillingCreateSchema": {
      "description": "Create request for Funder with 'medicaid' invoicing_model type",
      "allOf": [
        {
          "$ref": "#/components/schemas/FunderBaseCreateSchema"
        },
        {
          "$ref": "#/components/schemas/FunderElectronicBillingUpdateFieldsSchema"
        }
      ]
    },
    "FunderElectronicBillingUpdateSchema": {
      "description": "Create request for Funder with 'medicaid' invoicing_model type",
      "allOf": [
        {
          "$ref": "#/components/schemas/FunderBaseUpdateSchema"
        },
        {
          "$ref": "#/components/schemas/FunderElectronicBillingUpdateFieldsSchema"
        }
      ]
    },
    "FunderElectronicBillingUpdateFieldsSchema": {
      "type": "object",
      "required": [
        "payer_code",
        "payer_name",
        "provider_name",
        "payer_electronic_transmitter_id",
        "provider_electronic_transmitter_id",
        "provider_tax_id"
      ],
      "properties": {
        "organization_code": {
          "type": "string",
          "example": 23678
        },
        "organization_name": {
          "type": "string",
          "example": "Green Cross Inc."
        },
        "payer_code": {
          "type": "string",
          "example": "PYRCD"
        },
        "payer_name": {
          "type": "string",
          "example": "Senior Whole Health"
        },
        "provider_code": {
          "type": "string",
          "example": 1425636511
        },
        "provider_code_api": {
          "type": "string",
          "example": 123456789
        },
        "send_provider_code_as": {
          "type": "string",
          "example": "npi",
          "enum": [
            "npi",
            "api"
          ]
        },
        "provider_name": {
          "type": "string",
          "example": "Care provider"
        },
        "payer_electronic_transmitter_id": {
          "type": "string",
          "example": 238561
        },
        "provider_electronic_transmitter_id": {
          "type": "string",
          "example": 841263
        },
        "provider_tax_id": {
          "type": "string",
          "example": 231424221
        },
        "provider_taxonomy_code": {
          "type": "string",
          "example": "251E00000X"
        },
        "business_entity_id": {
          "type": "string",
          "example": "211312312LL"
        },
        "uses_bank": {
          "type": "boolean",
          "example": true
        },
        "send_bill_code_description": {
          "type": "string",
          "example": "bill_code_description",
          "enum": [
            "bill_code_description",
            "visit_start_and_end_time",
            "do_not_send"
          ]
        },
        "supervising_provider_secondary": {
          "type": "boolean",
          "example": true
        },
        "claim_type": {
          "type": "string",
          "example": "institutional",
          "enum": [
            "institutional",
            "professional"
          ]
        },
        "claim_breakdown_frequency": {
          "type": "string",
          "example": "weekly",
          "enum": [
            "lifetime",
            "daily",
            "weekly",
            "calendar_month"
          ]
        },
        "end_of_week": {
          "type": "string",
          "example": "Monday",
          "enum": [
            "Sunday",
            "Monday",
            "Tuesday",
            "Wednesday",
            "Thursday",
            "Friday",
            "Saturday"
          ]
        },
        "clearing_house": {
          "description": "Claim destination system for initial billing",
          "type": "string",
          "example": "waystar",
          "enum": [
            "waystar",
            "tellus",
            "hhax",
            "tellus_rs"
          ]
        },
        "rebill_clearing_house": {
          "description": "Claim destination system for re-billing",
          "type": "string",
          "example": "waystar",
          "enum": [
            "waystar",
            "tellus",
            "hhax",
            "tellus_rs"
          ]
        },
        "evv_destination_system": {
          "description": "EVV destination system",
          "type": "string",
          "example": "sandata",
          "enum": [
            "None",
            "sandata",
            "emed_ny",
            "vesta",
            "tellus_rs",
            "hhax"
          ]
        },
        "export_type": {
          "description": "Export type for initial billing",
          "type": "string",
          "example": "manual",
          "enum": [
            "manual",
            "electronic",
            "claim_pdf"
          ]
        },
        "rebill_export_type": {
          "description": "Export type for re-billing",
          "type": "string",
          "example": "manual",
          "enum": [
            "manual",
            "electronic",
            "claim_pdf"
          ]
        },
        "export_template": {
          "description": "Export template for initial billing",
          "type": "string",
          "example": "cms_1500_no_background",
          "enum": [
            "cms_1500_no_background",
            "cms_1500_with_background"
          ]
        },
        "rebill_export_template": {
          "description": "Export template for re-billing",
          "type": "string",
          "example": "cms_1500_no_background",
          "enum": [
            "cms_1500_no_background",
            "cms_1500_with_background"
          ]
        },
        "referring_provider": {
          "type": "string",
          "example": "agency_at_claim_level",
          "enum": [
            "agency_at_claim_level",
            "agency_at_service_line_level",
            "contact_at_claim_level",
            "contact_at_service_line_level",
            "do_not_send"
          ]
        },
        "rendering_provider": {
          "type": "string",
          "example": "agency_at_service_line_level",
          "enum": [
            "agency_at_claim_level",
            "agency_at_service_line_level",
            "contact_at_claim_level",
            "contact_at_service_line_level",
            "employee_at_service_line_level",
            "do_not_send"
          ]
        },
        "supervising_provider": {
          "type": "string",
          "example": "agency_at_claim_level",
          "enum": [
            "agency_at_claim_level",
            "contact_at_claim_level",
            "contact_at_service_line_level",
            "do_not_send"
          ]
        },
        "operating_provider": {
          "type": "string",
          "example": "do_not_send",
          "enum": [
            "agency_at_claim_level",
            "agency_at_service_line_level",
            "contact_at_claim_level",
            "contact_at_service_line_level",
            "do_not_send"
          ]
        },
        "ordering_provider": {
          "type": "string",
          "example": "contact_at_service_line_level",
          "enum": [
            "agency_at_service_line_level",
            "contact_at_service_line_level",
            "do_not_send"
          ]
        },
        "attending_provider": {
          "type": "string",
          "example": "contact_at_claim_level",
          "enum": [
            "agency_at_claim_level",
            "contact_at_claim_level",
            "do_not_send"
          ]
        },
        "service_facility": {
          "type": "string",
          "example": "agency_at_claim_level",
          "enum": [
            "agency_at_claim_level",
            "agency_at_service_line_level",
            "client_at_claim_level",
            "client_at_service_line_level",
            "do_not_send"
          ]
        },
        "ambulance_location": {
          "type": "boolean",
          "example": true
        },
        "attach_claim_documentation": {
          "type": "boolean",
          "example": true
        },
        "attachment_report_type": {
          "type": "string",
          "enum": [
            "IR",
            "LA",
            "M1",
            "MT",
            "NN",
            "OB",
            "OC",
            "OD",
            "OE",
            "OX",
            "OZ",
            "P4",
            "P5",
            "PE",
            "PN",
            "PO",
            "PQ",
            "PY",
            "PZ",
            "RB",
            "RR",
            "RT",
            "RX",
            "SG",
            "V5",
            "XP"
          ],
          "example": "IR"
        },
        "transmission_method": {
          "type": "string",
          "enum": [
            "AA",
            "BM",
            "EL",
            "EM",
            "FT",
            "FX"
          ],
          "example": "FX"
        },
        "send_patient_injury_info": {
          "type": "boolean",
          "example": true
        },
        "plan_id": {
          "type": "string",
          "enum": [
            "10",
            "18",
            "19",
            "1A",
            "1E",
            "1P",
            "2Q",
            "31",
            "33",
            "34",
            "36",
            "37",
            "3G",
            "3H",
            "40",
            "42",
            "43",
            "44",
            "45",
            "46",
            "47",
            "4F",
            "4G",
            "4H",
            "50",
            "52",
            "53",
            "5A",
            "5B",
            "63",
            "66",
            "67",
            "69",
            "6C",
            "6F",
            "6G",
            "71",
            "72",
            "79",
            "7G",
            "7H",
            "7P",
            "7Q",
            "7R",
            "7S",
            "7V",
            "7Z",
            "82",
            "83",
            "85",
            "86",
            "8G",
            "8H",
            "8J",
            "8K",
            "8L",
            "8R",
            "8S",
            "8T",
            "90",
            "93",
            "95",
            "9F",
            "9H",
            "9J",
            "9K",
            "C1",
            "C2",
            "C3",
            "C4",
            "C5",
            "CCCP",
            "FMSP",
            "H1",
            "H2",
            "H3",
            "H4",
            "H5",
            "H6",
            "H7",
            "H8",
            "H9",
            "HA",
            "K1",
            "K2",
            "K3",
            "K4",
            "K5",
            "K6",
            "K7",
            "K8",
            "K9",
            "KA",
            "KB",
            "KC",
            "KD",
            "KE",
            "KF",
            "KG",
            "KH",
            "KJ",
            "KL",
            "KM",
            "KN",
            "KP",
            "KQ",
            "KR",
            "KS",
            "KT",
            "KU",
            "KV",
            "MEDA",
            "MEDF",
            "N1",
            "N2",
            "N3",
            "N4",
            "NONE",
            "SLTC",
            "SMMA",
            "W2",
            "W3",
            "W4",
            "W5",
            "W6"
          ],
          "example": "MEDA"
        },
        "program_id": {
          "type": "string",
          "enum": [
            "590-CCSP",
            "660-ICWP",
            "680-NOW",
            "681-COMP",
            "930-SOURCE",
            "971-GAPP",
            "AD",
            "CDD",
            "DDAD",
            "DDAID",
            "F",
            "FLCF",
            "FLFD",
            "FLIB",
            "FLLC",
            "FLLT",
            "FLME",
            "FLMF",
            "FLMM",
            "FLMW",
            "FLPA",
            "FLTB",
            "I",
            "J",
            "L",
            "M",
            "N",
            "PA67",
            "PAAA",
            "PAAC",
            "PAAG",
            "PAAI",
            "PACE",
            "PACH",
            "PACL",
            "PACO",
            "PACW",
            "PAFD",
            "PAIN",
            "PAMC",
            "PAOB",
            "PASS",
            "PAWI"
          ],
          "example": "PACL"
        },
        "delivery_system": {
          "type": "string",
          "enum": [
            "FFFS",
            "MCOR"
          ],
          "example": "FFFS"
        },
        "timely_filing_window": {
          "type": "string",
          "enum": [
            "10",
            "30",
            "60",
            "90",
            "120",
            "180",
            "365",
            "none"
          ],
          "example": "30"
        },
        "tenant_qualifier": {
          "type": "string",
          "example": "ZZ"
        },
        "tenant_id": {
          "type": "string",
          "example": 702765200
        },
        "clearing_house_qualifier": {
          "type": "string",
          "example": "ZZ"
        },
        "rebill_clearing_house_qualifier": {
          "type": "string",
          "example": "ZZ"
        },
        "clearing_house_id": {
          "type": "string",
          "example": "ZIRMED"
        },
        "rebill_clearing_house_id": {
          "type": "string",
          "example": "ZIRMED"
        },
        "claim_grouping_methodology": {
          "type": "string",
          "example": "details_with_modifier",
          "enum": [
            "details_no_modifier",
            "details_with_modifier",
            "group_by_date"
          ]
        },
        "referring_provider_code": {
          "type": "string",
          "example": 123456789
        },
        "referring_provider_qualifier": {
          "type": "string",
          "example": "XX"
        },
        "ordering_provider_code": {
          "type": "string",
          "example": 123456789
        },
        "ordering_provider_qualifier": {
          "type": "string",
          "example": "XX"
        },
        "rendering_provider_code": {
          "type": "string",
          "example": 123456789
        },
        "rendering_provider_qualifier": {
          "type": "string",
          "example": "XX"
        },
        "operating_provider_code": {
          "type": "string",
          "example": 123456789
        },
        "operating_provider_qualifier": {
          "type": "string",
          "example": "XX"
        },
        "attending_provider_code": {
          "type": "string",
          "example": 123456789
        },
        "attending_provider_qualifier": {
          "type": "string",
          "example": "XX"
        },
        "relase_of_information_code": {
          "type": "string",
          "enum": [
            "Y",
            "I"
          ]
        }
      }
    },
    "FunderHcpCreateSchema": {
      "description": "Create request for Funder with 'hcp' invoicing_model type",
      "allOf": [
        {
          "$ref": "#/components/schemas/FunderBaseCreateSchema"
        },
        {
          "$ref": "#/components/schemas/FunderHcpUpdateFieldsSchema"
        }
      ]
    },
    "FunderHcpUpdateSchema": {
      "description": "Create request for Funder with 'hcp' invoicing_model type",
      "allOf": [
        {
          "$ref": "#/components/schemas/FunderBaseUpdateSchema"
        },
        {
          "$ref": "#/components/schemas/FunderHcpUpdateFieldsSchema"
        }
      ]
    },
    "FunderHcpUpdateFieldsSchema": {
      "type": "object",
      "required": [
        "organization_code",
        "organization_name",
        "unearned_revenue_account_id"
      ],
      "properties": {
        "organization_code": {
          "type": "integer",
          "example": 1
        },
        "organization_name": {
          "type": "integer",
          "example": 1
        },
        "recognized_revenue_account_id": {
          "type": "integer",
          "example": 1
        },
        "unearned_revenue_account_id": {
          "type": "integer",
          "example": 1
        }
      }
    },
    "CostCentre": {
      "description": "Details of a cost centre",
      "type": "object",
      "properties": {
        "description": {
          "type": "string",
          "description": "Cost centre description",
          "example": "Montreal"
        },
        "id": {
          "type": "integer",
          "description": "Cost centre ID",
          "example": 2,
          "minimum": 1
        },
        "number": {
          "type": "string",
          "description": "Cost centre number for display in-app",
          "example": "5555"
        },
        "status": {
          "type": "string",
          "description": "Cost centre status",
          "example": "enabled"
        }
      },
      "nullable": true
    },
    "ActivityCode": {
      "description": "Details of a cost centre",
      "type": "object",
      "properties": {
        "description": {
          "type": "string",
          "description": "Activity Code description",
          "example": "Some description"
        },
        "id": {
          "type": "integer",
          "description": "Activity Code ID",
          "example": 2
        },
        "code": {
          "type": "string",
          "description": "Activity Code code field",
          "example": "5555"
        },
        "branch": {
          "$ref": "#/components/schemas/BranchSummary"
        }
      },
      "nullable": true
    },
    "ActivityCodeList": {
      "allOf": [
        {
          "$ref": "#/components/schemas/PaginatedList"
        }
      ],
      "description": "Paginated list of activity codes",
      "type": "object",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ActivityCode"
          }
        }
      }
    },
    "CostCentreList": {
      "allOf": [
        {
          "$ref": "#/components/schemas/PaginatedList"
        }
      ],
      "description": "Paginated list of cost centres",
      "type": "object",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/CostCentre"
          }
        }
      }
    },
    "CostCentreClientCreate": {
      "type": "object",
      "properties": {
        "client_id": {
          "type": "integer",
          "description": "client ID",
          "example": 1010,
          "minimum": 1
        },
        "client_external_id": {
          "type": "string",
          "description": "client external ID",
          "example": "john.1010"
        }
      }
    },
    "CostCentreClientResponse": {
      "description": "Client to cost centre link",
      "type": "object",
      "properties": {
        "client_id": {
          "type": "integer",
          "description": "client ID",
          "example": 1010,
          "minimum": 1
        },
        "cost_centre_id": {
          "type": "integer",
          "description": "Cost centre ID",
          "example": 10,
          "minimum": 1
        }
      }
    },
    "CostCentreEmployeeCreateSchema": {
      "type": "object",
      "properties": {
        "employee_id": {
          "type": "integer",
          "description": "Employee ID",
          "example": 1010,
          "minimum": 1
        },
        "employee_external_id": {
          "type": "string",
          "description": "Employee external ID",
          "example": "john.1010"
        }
      }
    },
    "CostCentreEmployeeResponse": {
      "description": "Employee to cost centre link",
      "type": "object",
      "properties": {
        "employee_id": {
          "type": "integer",
          "description": "Employee ID",
          "example": 1010,
          "minimum": 1
        },
        "cost_centre_id": {
          "type": "integer",
          "description": "Cost centre ID",
          "example": 10,
          "minimum": 1
        }
      }
    },
    "StatusReasonsList": {
      "allOf": [
        {
          "$ref": "#/components/schemas/PaginatedList"
        }
      ],
      "description": "Paginated list of status reasons",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/StatusReasonDetail"
          }
        }
      }
    },
    "StatusReasonDetail": {
      "description": "Client status reason.",
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "AlayaCare status reason ID.",
          "example": 1
        },
        "status": {
          "type": "string",
          "description": "Alayacare client status",
          "example": "on_hold",
          "enum": [
            "on_hold",
            "discharged"
          ]
        },
        "name": {
          "type": "string",
          "description": "AlayaCare status reason name.",
          "example": "Vacation"
        },
        "description": {
          "type": "string",
          "description": "AlayaCare status reason description",
          "example": "Yearly summer vacation."
        },
        "branch": {
          "type": "object",
          "description": "AlayaCare branch",
          "properties": {
            "id": {
              "type": "integer",
              "description": "Branch ID",
              "example": 1000,
              "minimum": 1
            },
            "name": {
              "type": "string",
              "description": "Branch name",
              "example": "Toronto branch"
            }
          }
        }
      }
    },
    "Premium": {
      "description": "A premium configured in AlayaCare Accounting Settings",
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "description": "AlayaCare premium code name",
          "example": "MILEAGE"
        },
        "premium_id": {
          "type": "integer",
          "description": "AlayaCare premium ID",
          "example": 643,
          "minimum": 1
        },
        "pay_code": {
          "$ref": "#/components/schemas/PayCode"
        },
        "bill_codes": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/BillCode"
          }
        },
        "rule": {
          "type": "string",
          "description": "AlayaCare premium rule name",
          "example": "Weekends"
        },
        "branch": {
          "$ref": "#/components/schemas/Branch"
        }
      },
      "required": [
        "code",
        "premium_id"
      ]
    },
    "VisitPremiumDetails": {
      "description": "A visit premium",
      "type": "object",
      "properties": {
        "visit_premium_id": {
          "type": "integer",
          "description": "AlayaCare visit premium ID",
          "example": 345,
          "minimum": 1
        },
        "description": {
          "type": "string",
          "description": "Description of the visit premium",
          "example": "Reported travel KMs"
        },
        "quantity": {
          "type": "integer",
          "description": "Quantity of premiums applied to the visit",
          "example": 2
        },
        "premium": {
          "$ref": "#/components/schemas/Premium"
        }
      },
      "required": [
        "visit_premium_id",
        "quantity",
        "premium"
      ]
    },
    "VisitPremiumsList": {
      "allOf": [
        {
          "$ref": "#/components/schemas/PaginatedList"
        }
      ],
      "type": "object",
      "description": "Paginated list of premiums",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/VisitPremiumDetails"
          }
        }
      }
    },
    "PremiumsList": {
      "allOf": [
        {
          "$ref": "#/components/schemas/PaginatedList"
        }
      ],
      "type": "object",
      "description": "Paginated list of premiums",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/Premium"
          }
        }
      }
    },
    "Branch": {
      "description": "AlayaCare branch",
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "Branch ID",
          "example": 1000,
          "minimum": 1
        },
        "name": {
          "type": "string",
          "description": "Branch name",
          "example": "AlayaCare Health"
        }
      }
    },
    "BillCode": {
      "description": "AlayaCare bill code",
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "AlayCare bill code ID",
          "example": 783,
          "minimum": 1
        },
        "code": {
          "type": "string",
          "description": "AlayCare bill code name",
          "example": "MEDIBILL"
        }
      },
      "required": [
        "id",
        "code"
      ]
    },
    "PayCode": {
      "description": "AlayaCare pay code",
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "AlayCare pay code ID",
          "example": 3,
          "minimum": 1
        },
        "code": {
          "type": "string",
          "description": "AlayCare pay code name",
          "example": 783
        }
      }
    },
    "PremiumCreateSchema": {
      "type": "object",
      "required": [
        "code"
      ],
      "properties": {
        "code": {
          "type": "string",
          "example": "TESTCODE"
        },
        "pay_code_id": {
          "type": "integer",
          "example": 1,
          "minimum": 1
        },
        "branch_id": {
          "type": "integer",
          "example": 1,
          "minimum": 1
        },
        "bill_codes": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/BillCodeStub"
          }
        }
      }
    },
    "PremiumUpdateSchema": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "example": "TESTCODE"
        },
        "pay_code_id": {
          "type": "integer",
          "example": 1,
          "minimum": 1
        },
        "bill_codes": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/BillCodeStub"
          }
        }
      }
    },
    "PremiumExtendedSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 453
        },
        "guid": {
          "type": "integer",
          "example": 356689
        },
        "code": {
          "type": "string",
          "example": "TESTCODE"
        },
        "pay_code": {
          "$ref": "#/components/schemas/PayCodeSchema"
        },
        "rule": {
          "type": "string",
          "example": "Evening"
        },
        "rule_data": {
          "description": "Not really supported but returned as is, the rule data is stored as a json",
          "type": "string",
          "example": null
        },
        "bill_codes": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/BillCodeQuerySchema"
          }
        }
      }
    },
    "BillCodeStub": {
      "type": "object",
      "description": "Only one of id or guid should be present",
      "properties": {
        "id": {
          "type": "integer",
          "example": 3
        },
        "guid": {
          "type": "integer",
          "example": 3
        }
      }
    },
    "BillCodeQuerySchema": {
      "properties": {
        "branch": {
          "$ref": "#/components/schemas/Branch"
        },
        "code": {
          "type": "string"
        },
        "excluded_from_billing": {
          "type": "boolean"
        },
        "guid": {
          "type": "integer"
        },
        "id": {
          "type": "integer"
        },
        "is_disabled": {
          "type": "boolean"
        },
        "name": {
          "type": "string"
        },
        "units": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "code",
        "name",
        "excluded_from_billing",
        "is_disabled",
        "units"
      ],
      "type": "object"
    },
    "VisitPremiumCreateSchema": {
      "type": "object",
      "required": [
        "premium_id",
        "quantity"
      ],
      "properties": {
        "premium_id": {
          "type": "integer",
          "description": "AlayaCare premium ID",
          "minimum": 1
        },
        "quantity": {
          "type": "number",
          "example": 1.01
        },
        "description": {
          "type": "string",
          "example": "Mileage KMs"
        },
        "override_locked_visit": {
          "type": "boolean",
          "example": false,
          "description": "Flag to override a locked visit. A visit is considered \"locked\" in AlayaCare when it is included in a billing or payroll run.\n\nOnly users with the correct permissions enabled may edit a \"locked\" visit.\n\nNote that if a visit is locked and this flag is sent as `true`, your organization may need to re-run billing or payroll in the AlayaCare web application to properly reflect the changes.\n"
        }
      }
    },
    "VisitPremiumUpdateSchema": {
      "type": "object",
      "properties": {
        "premium_id": {
          "type": "integer",
          "description": "AlayaCare premium ID",
          "minimum": 1
        },
        "quantity": {
          "type": "number",
          "example": 1.01
        },
        "description": {
          "type": "string",
          "example": "Mileage KMs"
        }
      }
    },
    "TimeOffList": {
      "allOf": [
        {
          "$ref": "#/components/schemas/PaginatedList"
        }
      ],
      "description": "List of time off types",
      "type": "object",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TimeOff"
              }
            ]
          }
        }
      }
    },
    "TimeOff": {
      "description": "Time off type details",
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "ID of the time off type",
          "example": 1
        },
        "name": {
          "type": "string",
          "description": "Name of the time off type",
          "example": "Sick Paid"
        },
        "pay_schedule_time": {
          "type": "string",
          "description": "Time off type usable payable scheduled hours for payroll configuration",
          "example": false,
          "enum": [
            false,
            "Time_Off_Pay_Code",
            "Visit_Pay_Code"
          ]
        },
        "all_day_duration": {
          "type": "integer",
          "description": "All day duration in minutes.",
          "example": 480
        },
        "service": {
          "$ref": "#/components/schemas/ServiceCodeDetails"
        },
        "branch": {
          "$ref": "#/components/schemas/BranchSummary"
        }
      }
    },
    "BranchSummary": {
      "description": "Branch summary",
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "ID of the branch",
          "example": 1,
          "minimum": 1
        },
        "name": {
          "type": "string",
          "description": "Name of the branch",
          "example": "Headquarters"
        }
      }
    },
    "ServiceCodeDetails": {
      "description": "Service details",
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "ID of the service code",
          "example": 1,
          "minimum": 1
        },
        "service_code_name": {
          "type": "string",
          "description": "Name of the service code",
          "example": "SICKPAID"
        }
      }
    },
    "FunderList": {
      "allOf": [
        {
          "$ref": "#/components/schemas/PaginatedList"
        }
      ],
      "description": "Paginated list of funders",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/FunderDetails"
          }
        }
      }
    },
    "FunderDetails": {
      "type": "object",
      "properties": {
        "id": {
          "description": "AlayaCare funder ID",
          "type": "integer",
          "example": 1,
          "minimum": 1
        },
        "external_id": {
          "description": "External funder ID",
          "type": "string",
          "example": "sor_funder_id_1",
          "nullable": true
        },
        "name": {
          "description": "Funder name",
          "type": "string",
          "example": "Insurance Company"
        },
        "code": {
          "description": "Funder code",
          "type": "string",
          "example": "IC-1"
        },
        "type": {
          "description": "Funder type",
          "type": "string",
          "enum": [
            "funder_individual",
            "client_individual",
            "electronic_billing",
            "funder_batched",
            "ccac",
            "hcp"
          ]
        },
        "status": {
          "description": "Funder status",
          "type": "string",
          "enum": [
            "enabled",
            "disabled"
          ]
        },
        "organization": {
          "description": "Organization",
          "type": "string",
          "example": "Home Healthcare Agency"
        },
        "organization_code": {
          "description": "Organization code",
          "type": "string",
          "example": "HHC-0101"
        },
        "branch": {
          "$ref": "#/components/schemas/BranchSummary"
        }
      },
      "required": [
        "id",
        "name"
      ]
    },
    "FunderScalarSchema": {
      "anyOf": [
        {
          "$ref": "#/components/schemas/FunderCommonScalarSchema"
        },
        {
          "$ref": "#/components/schemas/FunderCcacScalarSchema"
        },
        {
          "$ref": "#/components/schemas/FunderHcpScalarSchema"
        }
      ]
    },
    "FunderBaseScalarSchema": {
      "allOf": [
        {
          "type": "object",
          "properties": {
            "code": {
              "description": "Funder Code",
              "type": "string",
              "example": "Code"
            },
            "created_at": {
              "description": "Date and time of creation",
              "type": "string",
              "example": "2015-09-22T12:48:21+00:00"
            },
            "create_user_id": {
              "description": "ID of User who created the funder",
              "type": "integer",
              "example": 100,
              "minimum": 1
            },
            "description": {
              "description": "The description of the Funder",
              "type": "string",
              "example": "Description"
            },
            "gl_asset": {
              "description": "General Ledger Asset Account",
              "allOf": [
                {
                  "$ref": "#/components/schemas/LinkedEntitySchema"
                }
              ]
            },
            "gl_bank": {
              "description": "General Ledger Bank Account",
              "allOf": [
                {
                  "$ref": "#/components/schemas/LinkedEntitySchema"
                }
              ]
            },
            "guid": {
              "type": "integer",
              "example": 12,
              "description": "Globally Unique Identifier"
            },
            "holiday_multiplier": {
              "description": "Multiplier applied to Funder for holiday periods",
              "type": "number",
              "example": "1.00"
            },
            "id": {
              "description": "Funder ID",
              "type": "integer",
              "example": 1,
              "minimum": 1
            },
            "import_id": {
              "type": "integer",
              "example": 1
            },
            "invoicing_model": {
              "description": "The type of invoicing model used by the Funder",
              "type": "string",
              "example": "batched"
            },
            "is_disabled": {
              "type": "boolean",
              "example": false
            },
            "is_read_only": {
              "type": "boolean",
              "example": false
            },
            "label": {
              "type": "string",
              "example": "Name",
              "description": "Always the same as `name`"
            },
            "name": {
              "type": "string",
              "example": "Name"
            },
            "profile": {
              "$ref": "#/components/schemas/ProfileSchema"
            },
            "taxes": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/FunderTaxesItemSchema"
              }
            },
            "updated_at": {
              "type": "string",
              "example": "2017-09-27T00:01:00-04:00"
            },
            "update_user_id": {
              "type": "integer",
              "example": 2,
              "minimum": 1
            },
            "gl_receivables_cost_centre": {
              "$ref": "#/components/schemas/CostCentreSchema"
            },
            "gl_bank_cost_centre": {
              "$ref": "#/components/schemas/CostCentreSchema"
            },
            "gl_receivables_cost_centre_id": {
              "type": "integer",
              "example": 2
            },
            "gl_bank_cost_centre_id": {
              "type": "integer",
              "example": 2
            },
            "branch_id": {
              "type": "integer",
              "example": 100,
              "minimum": 1
            },
            "line_item_limit": {
              "type": "number",
              "example": 76
            }
          }
        }
      ]
    },
    "FunderCommonScalarSchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/FunderBaseScalarSchema"
        }
      ],
      "properties": {
        "allow_paypal_payment": {
          "type": "boolean",
          "description": "Funder can use paypal",
          "example": false
        },
        "agency_profile": {
          "$ref": "#/components/schemas/LinkedEntitySchema"
        },
        "billing_contact": {
          "$ref": "#/components/schemas/LinkedEntitySchema"
        },
        "organization_code": {
          "type": "string",
          "example": "HHC-0101"
        },
        "organization_name": {
          "type": "string",
          "example": "Home Healthcare Agency"
        },
        "billing_frequency": {
          "type": "string",
          "enum": [
            "no_frequency",
            "weekly",
            "calendar_month"
          ]
        }
      }
    },
    "FunderCcacScalarSchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/FunderBaseScalarSchema"
        }
      ],
      "properties": {
        "ccac_code": {
          "type": "string",
          "description": "CCAC code"
        },
        "ccac_name": {
          "type": "string",
          "description": "CCAC name"
        },
        "organization_code": {
          "type": "string",
          "example": "HHC-0101"
        },
        "organization_name": {
          "type": "string",
          "example": "Home Healthcare Agency"
        },
        "billing_adjustment_period": {
          "type": "integer",
          "example": 1
        },
        "file_name_prefix": {
          "type": "string"
        },
        "billing_frequency": {
          "type": "string",
          "enum": [
            "no_frequency",
            "weekly",
            "calendar_month"
          ]
        }
      }
    },
    "FunderHcpScalarSchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/FunderBaseScalarSchema"
        }
      ],
      "properties": {
        "organization_code": {
          "type": "string",
          "example": "HHC-0101"
        },
        "organization_name": {
          "type": "string",
          "example": "Home Healthcare Agency"
        },
        "recognized_revenue_account_id": {
          "type": "integer",
          "example": 1
        },
        "unearned_revenue_account_id": {
          "type": "integer",
          "example": 1
        }
      }
    },
    "EVVExportList": {
      "allOf": [
        {
          "$ref": "#/components/schemas/PaginatedList"
        }
      ],
      "description": "Paginated list of EVV Export",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/EVVExport"
          }
        }
      }
    },
    "EVVExport": {
      "description": "EVV Export",
      "type": "object",
      "properties": {
        "evv_export_id": {
          "type": "integer",
          "description": "ID of the EVV export record",
          "example": 1
        },
        "export_key": {
          "type": "string",
          "description": "Combined export record key; currently branch id, claim destination system and export type.",
          "example": "1000.HHAeXCchange.SCHEDULED"
        },
        "branch_id": {
          "type": "integer",
          "description": "Branch ID",
          "example": 1000,
          "minimum": 1
        },
        "claim_destination_system": {
          "type": "string",
          "description": "Claim destination system",
          "example": "Tellus Rendered Services",
          "enum": [
            "HHAeXchange",
            "eMedNY",
            "Tellus Rendered Services",
            "Sandata"
          ]
        },
        "state": {
          "type": "string",
          "description": "Export state",
          "example": "NY"
        },
        "export_type": {
          "type": "string",
          "description": "Export type",
          "example": "BILLED",
          "enum": [
            "SCHEDULED",
            "DELETED",
            "MISSED",
            "APPROVED",
            "BILLED"
          ]
        },
        "fetch_visits_from": {
          "type": "string",
          "description": "Start date and time of when visits were processed in UTC",
          "example": "2020-01-01T00:00:00+00:00"
        },
        "fetch_visits_until": {
          "type": "string",
          "description": "End date and time of when visits were processed in UTC",
          "example": "2020-01-01T00:00:00+00:00"
        },
        "date_sent_at": {
          "type": "string",
          "description": "Date and time the export was sent to the destination system in UTC format",
          "example": "2020-01-01T00:00:00+00:00"
        },
        "number_of_visits": {
          "type": "integer",
          "description": "Number of visits included",
          "example": 10
        },
        "status_of_background_job": {
          "type": "string",
          "description": "Status of the EVV Export job",
          "example": "SUCCESS",
          "enum": [
            "STARTED",
            "SUCCESS",
            "FAILURE",
            "NOT_SENT"
          ]
        },
        "url_file_location": {
          "type": "string",
          "description": "URL of file location if the export was successful",
          "example": "https://"
        },
        "error_details": {
          "type": "string",
          "description": "EVV export error details",
          "example": "File cannot be sent - connection issues"
        },
        "created_at": {
          "type": "string",
          "description": "Date and time in UTC format when the export record was created",
          "example": "2020-01-01T00:00:00+00:00"
        },
        "is_custom": {
          "type": "boolean",
          "description": "indicates if it's a custom export or a regular One",
          "example": false
        },
        "on_demand_request_id": {
          "type": "integer",
          "description": "request_id associated with a custom export. Used for reprocessing and having a control about visits that should be inside",
          "example": 998
        },
        "is_activation": {
          "type": "boolean",
          "description": "if export is related to an is_activation",
          "example": true
        }
      }
    },
    "EVVExportLatestExportDate": {
      "description": "Latest EVV export date in UTC format for the specified branch ID, claim destination and export type regardless of its state or default date if no record is found",
      "type": "object",
      "properties": {
        "latest_export_date": {
          "type": "string",
          "description": "Date and time in UTC format of the last export",
          "example": "2020-01-01T00:00:00+00:00"
        }
      }
    },
    "ErrorResponse": {
      "description": "Error response",
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "example": 400,
          "description": "Response code"
        },
        "message": {
          "type": "string",
          "example": "Invalid request",
          "description": "Detailed error message"
        }
      },
      "required": [
        "code",
        "message"
      ]
    },
    "NotFound": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "example": 404
        },
        "message": {
          "type": "string",
          "example": "Entity not found"
        }
      },
      "required": [
        "code",
        "message"
      ]
    },
    "PaginatedList": {
      "description": "Base model of all paginated lists",
      "type": "object",
      "properties": {
        "count": {
          "type": "integer",
          "description": "Number of items in the response",
          "example": 10
        },
        "page": {
          "type": "integer",
          "description": "Current page number",
          "example": 1,
          "minimum": 1
        },
        "total_pages": {
          "type": "integer",
          "description": "Total number of pages available",
          "example": 1
        },
        "items": {
          "type": "array",
          "items": {
            "type": "object"
          }
        }
      },
      "required": [
        "count",
        "page",
        "total_pages",
        "items"
      ]
    },
    "BillingCycle": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "minimum": 1
        },
        "branch": {
          "$ref": "#/components/schemas/Branch"
        },
        "create_user": {
          "$ref": "#/components/schemas/User"
        },
        "update_user": {
          "$ref": "#/components/schemas/User"
        },
        "close_user": {
          "$ref": "#/components/schemas/User"
        },
        "create_time": {
          "type": "string",
          "format": "date-time"
        },
        "update_time": {
          "type": "string",
          "format": "date-time"
        },
        "closed_at": {
          "type": "string",
          "format": "date-time"
        },
        "guid": {
          "type": "integer"
        },
        "start_date": {
          "type": "string",
          "format": "date"
        },
        "end_date": {
          "type": "string",
          "format": "date"
        },
        "back_billing_date": {
          "type": "string",
          "format": "date",
          "nullable": true,
          "example": null
        },
        "invoice_date": {
          "type": "string",
          "format": "date"
        },
        "idstatus": {
          "type": "integer",
          "example": null
        },
        "overtime_check": {
          "type": "boolean",
          "example": null
        },
        "allow_shift_creation": {
          "type": "boolean",
          "example": true
        },
        "type": {
          "type": "string",
          "enum": [
            "legacy",
            "payor_invoicing"
          ],
          "example": "payor_invoicing"
        },
        "job_id": {
          "type": "integer"
        },
        "invoice_count": {
          "type": "integer",
          "description": "Count of invoices in any status"
        },
        "draft_invoice_count": {
          "type": "integer",
          "description": "Count of invoices in Draft status"
        },
        "sent_invoice_count": {
          "type": "integer",
          "description": "Count of invoices in Sent status = Sent, Paid, Write-Off"
        },
        "deleted_invoice_count": {
          "type": "integer",
          "description": "Count of invoices in Deleted status"
        },
        "is_first": {
          "type": "boolean",
          "description": "Boolean indicating if the program billing period is the first for that Branch - Frequency"
        },
        "is_latest": {
          "type": "boolean",
          "description": "Boolean indicating if the program billing period is the latest for that Branch - Frequency"
        }
      }
    },
    "BillingCycleCollection": {
      "type": "object",
      "properties": {
        "count": {
          "type": "integer"
        },
        "page": {
          "type": "integer",
          "minimum": 1
        },
        "items_per_page": {
          "type": "integer"
        },
        "total_pages": {
          "type": "integer"
        },
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/BillingCycle"
          }
        }
      }
    },
    "PayorInvoicingBillingPeriod": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "minimum": 1
        },
        "branch": {
          "$ref": "#/components/schemas/Branch"
        },
        "create_user": {
          "$ref": "#/components/schemas/User"
        },
        "update_user": {
          "$ref": "#/components/schemas/User"
        },
        "close_user": {
          "$ref": "#/components/schemas/User"
        },
        "create_time": {
          "type": "string",
          "format": "date-time"
        },
        "update_time": {
          "type": "string",
          "format": "date-time"
        },
        "closed_at": {
          "type": "string",
          "format": "date-time"
        },
        "guid": {
          "type": "integer"
        },
        "start_date": {
          "type": "string",
          "format": "date"
        },
        "end_date": {
          "type": "string",
          "format": "date"
        },
        "back_billing_date": {
          "type": "string",
          "format": "date",
          "nullable": true,
          "example": null
        },
        "invoice_date": {
          "type": "string",
          "format": "date"
        },
        "idstatus": {
          "type": "integer",
          "example": null
        },
        "overtime_check": {
          "type": "boolean",
          "example": null
        },
        "is_closed": {
          "type": "boolean",
          "example": false
        },
        "allow_shift_creation": {
          "type": "boolean",
          "example": true
        },
        "type": {
          "type": "string",
          "enum": [
            "legacy",
            "payor_invoicing"
          ],
          "example": "payor_invoicing"
        },
        "frequency": {
          "type": "integer",
          "description": "Displays the Billing Frequency selected"
        },
        "job_id": {
          "type": "integer"
        },
        "invoice_count": {
          "type": "integer",
          "description": "Count of invoices in any status"
        },
        "draft_invoice_count": {
          "type": "integer",
          "description": "Count of invoices in Draft status"
        },
        "sent_invoice_count": {
          "type": "integer",
          "description": "Count of invoices in Sent status = Sent, Paid, Write-Off"
        },
        "deleted_invoice_count": {
          "type": "integer",
          "description": "Count of invoices in Deleted status"
        },
        "is_first": {
          "type": "boolean",
          "description": "Boolean indicating if the program billing period is the first for that Branch - Frequency"
        },
        "is_latest": {
          "type": "boolean",
          "description": "Boolean indicating if the program billing period is the latest for that Branch - Frequency"
        },
        "funder_filters": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/FunderWithGuidSchema"
          }
        },
        "payor_type_filters": {
          "type": "array",
          "items": {
            "type": "string",
            "example": "individual_invoices"
          }
        }
      }
    },
    "User": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        },
        "first_name": {
          "type": "string"
        },
        "last_name": {
          "type": "string"
        }
      }
    },
    "FunderStub": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 8,
          "minimum": 1
        },
        "code": {
          "type": "string",
          "example": "Some Funder"
        },
        "name": {
          "type": "string",
          "example": "Some Funder"
        },
        "description": {
          "type": "string",
          "example": "Some Funder"
        },
        "invoicing_model": {
          "type": "string",
          "example": "funder_individual"
        }
      }
    },
    "FunderWithGuidSchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/FunderStub"
        },
        {
          "type": "object",
          "properties": {
            "guid": {
              "type": "integer",
              "example": 9
            }
          }
        }
      ]
    },
    "PayorInvoicingBillingPeriodCollection": {
      "type": "object",
      "properties": {
        "count": {
          "type": "integer"
        },
        "page": {
          "type": "integer",
          "minimum": 1
        },
        "items_per_page": {
          "type": "integer"
        },
        "total_pages": {
          "type": "integer"
        },
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/PayorInvoicingBillingPeriod"
          }
        }
      }
    },
    "PrivateInvoicesSchema": {
      "type": "object",
      "properties": {
        "invoice_number": {
          "type": "integer",
          "example": 2348
        },
        "invoice_version": {
          "type": "integer",
          "example": 0
        },
        "master_invoice_id": {
          "type": "integer",
          "example": 12345,
          "minimum": 1
        },
        "status": {
          "type": "string",
          "example": "draft"
        },
        "balance": {
          "type": "string",
          "example": "5.00"
        },
        "payments": {
          "type": "string",
          "example": "2.00"
        },
        "adjustments": {
          "type": "string",
          "example": "3.00"
        },
        "total": {
          "type": "string",
          "example": "10.00"
        },
        "pdf_url": {
          "type": "string",
          "example": "https://alayacare.com/invoice5283_20190625.pdf"
        },
        "pdf_url_create_time": {
          "type": "string",
          "format": "date-time",
          "example": "2018-01-16T14:17:05-0500"
        },
        "id": {
          "type": "integer",
          "example": 12,
          "minimum": 1
        },
        "emailed": {
          "type": "boolean",
          "example": true
        },
        "client": {
          "$ref": "#/components/schemas/ClientSchema"
        },
        "program": {
          "$ref": "#/components/schemas/ProgramSchema"
        },
        "payor": {
          "$ref": "#/components/schemas/PayorSchema"
        }
      }
    },
    "ClientSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 16,
          "minimum": 1
        },
        "first_name": {
          "type": "string",
          "example": "Jane"
        },
        "last_name": {
          "type": "string",
          "example": "Jones"
        }
      }
    },
    "ProgramSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 12345,
          "minimum": 1
        },
        "client": {
          "$ref": "#/components/schemas/ClientSchema"
        },
        "program_type": {
          "type": "string",
          "example": "LTCI"
        },
        "name": {
          "type": "string",
          "example": "Long Term Care Insurance"
        },
        "guarantor_funder": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 111
            },
            "code": {
              "type": "string",
              "example": "GF1"
            },
            "name": {
              "type": "string",
              "example": "Some Funder"
            }
          }
        },
        "guarantor_billing_contact": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 111
            },
            "first_name": {
              "type": "string",
              "example": "Bruce"
            },
            "last_name": {
              "type": "string",
              "example": "Lee"
            }
          }
        },
        "client_billing_cycle": {
          "type": "integer",
          "example": 999,
          "minimum": 1
        }
      }
    },
    "PayorSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 1,
          "minimum": 1
        },
        "checksum": {
          "type": "integer",
          "example": 7
        },
        "client": {
          "$ref": "#/components/schemas/ClientSchema"
        },
        "funder": {
          "$ref": "#/components/schemas/FunderStub"
        },
        "billing_contact": {
          "$ref": "#/components/schemas/BillingContactSchema"
        }
      }
    },
    "BillingContactSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 16
        },
        "first_name": {
          "type": "string",
          "example": "Jane"
        },
        "last_name": {
          "type": "string",
          "example": "Jones"
        },
        "address": {
          "type": "string",
          "example": "12 crescent street"
        },
        "address_suite": {
          "type": "string",
          "example": "app. 1B"
        },
        "city": {
          "type": "string",
          "example": "Cityville"
        },
        "state": {
          "type": "string",
          "example": "Quebec"
        },
        "zip": {
          "type": "string",
          "example": "H1H1H1"
        },
        "country": {
          "type": "string",
          "example": "Canada"
        },
        "phone_main": {
          "type": "string",
          "example": "5141234567"
        }
      }
    },
    "InvoiceItemSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 12,
          "minimum": 1
        },
        "invoice_id": {
          "type": "integer",
          "example": 12,
          "minimum": 1
        },
        "source_id": {
          "type": "integer",
          "example": 12
        },
        "subtotal": {
          "type": "number",
          "format": "double",
          "example": 10.0
        },
        "total_cost": {
          "type": "number",
          "format": "double",
          "example": 3.0
        },
        "total_taxes": {
          "type": "number",
          "format": "double",
          "example": 3.0
        },
        "total": {
          "type": "number",
          "format": "double",
          "example": 13.0
        },
        "ajdustment_type": {
          "type": "string",
          "example": "adjustment"
        },
        "create_user_id": {
          "type": "integer",
          "example": 2,
          "minimum": 1
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "example": "2018-01-16T14:17:05-0500"
        },
        "gl_asset_acc_account_id": {
          "type": "integer",
          "example": 2,
          "minimum": 1
        },
        "gl_revenue_acc_account_id": {
          "type": "integer",
          "example": 2,
          "minimum": 1
        },
        "item_end_at": {
          "type": "string",
          "format": "date",
          "example": "2018-01-16T14:17:05-0500"
        },
        "item_start_at": {
          "type": "string",
          "format": "date",
          "example": "2018-01-16T14:16:05-0500"
        },
        "memo": {
          "type": "string",
          "example": "memo"
        },
        "policy_version_id": {
          "type": "integer",
          "example": 2,
          "minimum": 1
        },
        "quantity": {
          "type": "number",
          "format": "double",
          "example": 2.0
        },
        "quantity_units": {
          "type": "string",
          "example": "hours"
        },
        "receivables_cost_centre_id": {
          "type": "integer",
          "example": 2,
          "minimum": 1
        },
        "taxable": {
          "type": "boolean",
          "example": true
        },
        "type": {
          "type": "string",
          "example": "visit"
        },
        "unitprice": {
          "type": "number",
          "format": "double",
          "example": 2.0
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "example": "2018-01-16T14:17:05-0500"
        },
        "update_user_id": {
          "type": "integer",
          "example": 2,
          "minimum": 1
        },
        "voided_by_id": {
          "type": "integer",
          "example": 2,
          "minimum": 1
        },
        "payor": {
          "$ref": "#/components/schemas/PayorSchema"
        }
      }
    },
    "InvoiceQuerySchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 12,
          "minimum": 1
        },
        "status": {
          "type": "string",
          "example": "draft"
        },
        "invoice_number": {
          "type": "integer",
          "example": 2348
        },
        "invoice_version": {
          "type": "integer",
          "example": 0
        },
        "invoice_date": {
          "type": "string",
          "format": "date",
          "example": "2018-01-16"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "example": "2018-01-16T14:17:05-0500"
        },
        "balance": {
          "type": "number",
          "example": 5
        },
        "total": {
          "type": "number",
          "example": 10
        },
        "can_be_written_off": {
          "type": "boolean",
          "example": false
        },
        "can_be_voided": {
          "type": "boolean",
          "example": false
        },
        "can_be_regenerated": {
          "type": "boolean",
          "example": false
        },
        "can_be_paid": {
          "type": "boolean",
          "example": false
        },
        "can_be_deleted": {
          "type": "boolean",
          "example": false
        },
        "can_add_transaction": {
          "type": "boolean",
          "example": false
        },
        "is_ccac_funder": {
          "type": "boolean",
          "example": false
        },
        "is_funder_batched_funder": {
          "type": "boolean",
          "example": false
        },
        "total_visits": {
          "type": "integer",
          "example": 2
        },
        "total_premiums": {
          "type": "integer",
          "example": 3
        },
        "total_supplies": {
          "type": "integer",
          "example": 4
        },
        "total_client_premiums": {
          "type": "integer",
          "example": 5
        },
        "total_income_items": {
          "type": "integer",
          "example": 6
        },
        "visits_and_premiums_subtotal": {
          "type": "number",
          "example": 10
        },
        "supplies_subtotal": {
          "type": "number",
          "example": 0
        },
        "client_premiums_subtotal": {
          "type": "number",
          "example": 5
        },
        "income_items_subtotal": {
          "type": "number",
          "example": 6
        },
        "client_id": {
          "type": "integer",
          "example": 2,
          "minimum": 1
        },
        "crn": {
          "type": "string",
          "example": "10009",
          "description": "Has value only if BPAY FF is ON and is already generated"
        },
        "taxes": {
          "$ref": "#/components/schemas/TaxesSchema"
        },
        "bill_to": {
          "$ref": "#/components/schemas/BillToSchema"
        },
        "pdf_url": {
          "type": "string",
          "example": "/path/to/file.pdf"
        },
        "invoice_items": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/InvoiceItemSchema"
          }
        }
      }
    },
    "TaxesSchema": {
      "type": "object",
      "properties": {
        "taxtotal": {
          "type": "number",
          "example": 2
        },
        "types": {
          "$ref": "#/components/schemas/TaxTypesSchema"
        }
      }
    },
    "TaxTypesSchema": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "example": "HST"
        },
        "total": {
          "type": "number",
          "example": 2
        }
      }
    },
    "BillToSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 12
        },
        "name": {
          "type": "string",
          "example": "Funder"
        },
        "guid": {
          "type": "string",
          "example": "27990"
        },
        "guid_to": {
          "type": "string",
          "example": "27991"
        },
        "is_active": {
          "type": "boolean",
          "example": true
        },
        "import_id": {
          "type": "integer",
          "example": 123
        },
        "remarks": {
          "type": "string",
          "example": "falls prevention program"
        },
        "contact_type": {
          "type": "string",
          "example": "Referral Contact"
        },
        "lang": {
          "type": "string",
          "example": "english"
        },
        "list": {
          "type": "string",
          "example": "Funder List (System)"
        }
      }
    },
    "AccountStub": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 1
        },
        "name": {
          "type": "string",
          "example": "AlayaCare"
        },
        "is_disabled": {
          "type": "boolean",
          "example": false
        }
      },
      "required": [
        "id",
        "name",
        "is_disabled"
      ]
    },
    "Account": {
      "description": "Account details",
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "Account ID",
          "example": 1,
          "minimum": 1
        },
        "branch": {
          "$ref": "#/components/schemas/BranchSummary"
        },
        "gl_number": {
          "type": "string",
          "description": "Account GL number",
          "example": 1000
        },
        "is_default": {
          "type": "boolean",
          "description": "Flag indicating if the account is the default account for the branch",
          "example": true
        },
        "is_disabled": {
          "type": "boolean",
          "description": "Flag indicating if the account is disabled",
          "example": false
        },
        "is_read_only": {
          "type": "boolean",
          "description": "Flag indicating if the account is read only",
          "example": false
        },
        "name": {
          "type": "string",
          "description": "Account name",
          "example": "AlayaCare"
        },
        "type": {
          "type": "string",
          "description": "Account type",
          "example": "asset",
          "enum": [
            "asset",
            "liability",
            "equity",
            "revenue",
            "expense"
          ]
        }
      }
    },
    "AccountList": {
      "allOf": [
        {
          "$ref": "#/components/schemas/PaginatedList"
        }
      ],
      "description": "Paginated list of accounts",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/Account"
          }
        }
      }
    },
    "ServiceCodeListSchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/PaginatedList"
        }
      ],
      "type": "object",
      "description": "Paginated list of service codes",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ServiceCodeSchema"
          }
        }
      }
    },
    "ServiceCodeSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 1,
          "minimum": 1
        },
        "description": {
          "type": "string",
          "example": "Sick Paid"
        },
        "name": {
          "type": "string",
          "example": "Sick Paid"
        },
        "label": {
          "type": "string",
          "example": "Sick Paid"
        },
        "is_disabled": {
          "type": "boolean",
          "example": false
        },
        "rating_methodology_type": {
          "type": "string",
          "example": "funder_driven"
        },
        "branch": {
          "$ref": "#/components/schemas/BranchSchema"
        },
        "department": {
          "$ref": "#/components/schemas/DepartmentSchema"
        },
        "pay_code_regular": {
          "$ref": "#/components/schemas/PayCodeSchema"
        },
        "pay_code_overtime": {
          "$ref": "#/components/schemas/PayCodeSchema"
        },
        "pay_code_holiday": {
          "$ref": "#/components/schemas/PayCodeSchema"
        },
        "expense_code": {
          "$ref": "#/components/schemas/PayCodeSchema"
        },
        "billcodes": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/BillCodeSchema"
          }
        }
      }
    },
    "BranchSchema": {
      "description": "The branch associated with the Billcode",
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 1,
          "minimum": 1
        },
        "name": {
          "type": "string",
          "example": "AlayaCare Health"
        }
      }
    },
    "DepartmentSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 1,
          "minimum": 1
        },
        "name": {
          "type": "string",
          "example": "AlayaCare Health"
        }
      }
    },
    "PayCodeSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 1,
          "minimum": 1
        },
        "code": {
          "type": "string",
          "example": "SP"
        }
      }
    },
    "BillCodeSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 1,
          "minimum": 1
        },
        "code": {
          "type": "string",
          "example": "SP"
        },
        "name": {
          "type": "string",
          "example": "Sick Paid"
        },
        "funder": {
          "$ref": "#/components/schemas/FunderStub"
        },
        "is_disabled": {
          "type": "boolean",
          "example": false
        }
      }
    },
    "ServiceCodeScalarSchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/ServiceCodeSchema"
        },
        {
          "type": "object",
          "properties": {
            "guid": {
              "type": "integer",
              "example": 1
            },
            "branch_id": {
              "type": "integer",
              "example": 1,
              "minimum": 1
            },
            "pay_code_id": {
              "type": "integer",
              "example": 1,
              "minimum": 1
            },
            "paycoderegular_id": {
              "type": "integer",
              "example": 1
            },
            "paycodeovertime_id": {
              "type": "integer",
              "example": 1
            },
            "paycodeholiday_id": {
              "type": "integer",
              "example": 1
            },
            "expense_code_id": {
              "type": "integer",
              "example": 1
            },
            "visits_can_overlap": {
              "type": "boolean",
              "example": true
            },
            "is_cancelled": {
              "type": "boolean",
              "example": false
            },
            "allow_virtual_care": {
              "type": "boolean",
              "example": true
            },
            "duration": {
              "type": "integer",
              "example": 10
            },
            "care_duration": {
              "type": "integer",
              "example": 10
            },
            "department_id": {
              "type": "integer",
              "example": 1,
              "minimum": 1
            },
            "disregard_employee_capacity": {
              "type": "boolean",
              "example": true
            },
            "matching_shift_late_start": {
              "type": "integer",
              "example": 10
            },
            "matching_shift_coverage": {
              "type": "number",
              "example": 10.0
            },
            "disregard_start_time": {
              "type": "boolean",
              "example": true
            },
            "disregard_shift_coverage": {
              "type": "boolean",
              "example": true
            },
            "ot_exempt": {
              "type": "boolean",
              "example": true
            },
            "bill_codes": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/BillCodeSchema"
              }
            }
          }
        }
      ]
    },
    "ServiceCodeEditSchema": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "example": "Sick Paid"
        },
        "description": {
          "type": "string",
          "example": "Sick Paid"
        },
        "paycoderegular_id": {
          "type": "integer",
          "example": 1
        },
        "paycodeovertime_id": {
          "type": "integer",
          "example": 1
        },
        "paycodeholiday_id": {
          "type": "integer",
          "example": 1
        },
        "expense_code_id": {
          "type": "integer",
          "example": 1
        },
        "department_id": {
          "type": "integer",
          "example": 1,
          "minimum": 1
        },
        "duration": {
          "type": "integer",
          "example": 10
        },
        "care_duration": {
          "type": "integer",
          "example": 10
        },
        "visits_can_overlap": {
          "type": "boolean",
          "example": true
        },
        "disregard_employee_capacity": {
          "type": "boolean",
          "example": true
        },
        "allow_virtual_care": {
          "type": "boolean",
          "example": true
        },
        "matching_shift_late_start": {
          "type": "integer",
          "example": 10
        },
        "matching_shift_coverage": {
          "type": "number",
          "example": 10.0
        },
        "disregard_start_time": {
          "type": "boolean",
          "example": true
        },
        "disregard_shift_coverage": {
          "type": "boolean",
          "example": true
        },
        "ot_exempt": {
          "type": "boolean",
          "example": true
        }
      }
    },
    "ServiceCodeCreateSchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/ServiceCodeEditSchema"
        },
        {
          "type": "object",
          "properties": {
            "rating_methodology_type": {
              "type": "string",
              "enum": [
                "funder_driven",
                "non_billable"
              ],
              "example": "funder_driven"
            },
            "branch_id": {
              "type": "integer",
              "description": "Branch ID",
              "minimum": 1
            },
            "rating_methodology_data": {
              "$ref": "#/components/schemas/ServiceCodeRatingMethodologyData"
            }
          }
        }
      ]
    },
    "ServiceCodeRatingMethodologyData": {
      "type": "object",
      "properties": {
        "bill_code_ids": {
          "type": "array",
          "items": {
            "type": "integer",
            "example": 1
          }
        }
      }
    },
    "Success": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string",
          "example": "Success"
        }
      }
    },
    "LinkedEntitySchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 12
        }
      }
    },
    "ProfileSchema": {
      "type": "object",
      "properties": {
        "first_name": {
          "type": "string",
          "example": "First name"
        },
        "last_name": {
          "type": "string",
          "example": "Last name"
        }
      }
    },
    "FunderTaxesItemSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 1
        },
        "name": {
          "type": "string",
          "example": "TPS"
        },
        "percentage": {
          "type": "number",
          "example": 15.001
        }
      }
    },
    "CostCentreSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 1,
          "minimum": 1
        },
        "number": {
          "type": "string",
          "example": "123"
        },
        "description": {
          "type": "string",
          "example": "123"
        }
      }
    },
    "RRuleSchema": {
      "type": "object",
      "description": "A recurrence rule for a Bill Code Rate",
      "properties": {
        "duration": {
          "type": "integer"
        },
        "rrule": {
          "type": "string",
          "pattern": "^(\\w+=\\w+)?(;\\w+=\\w+)*;?$",
          "example": "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;INTERVAL=1",
          "description": "A recurrence rule string following RFC-5545"
        },
        "start_at": {
          "type": "string",
          "format": "date-time",
          "example": "2019-01-01T00:00:00+00:00",
          "description": "Date the Rate begins to apply"
        },
        "end_at": {
          "type": "string",
          "format": "date-time",
          "example": "2019-01-01T00:00:00+00:00",
          "description": "Date the Rate begins to apply"
        }
      }
    },
    "BillCodeRateRRuleBaseSchema": {
      "type": "object",
      "properties": {
        "rate": {
          "type": "number",
          "example": 12.5
        },
        "external_id": {
          "type": "string",
          "pattern": "(^$|^[0-9a-zA-Z\\\\-_]+$)",
          "example": "123"
        },
        "order": {
          "type": "integer",
          "example": 1
        },
        "override_holiday_multiplicator": {
          "type": "integer",
          "description": "effectively a boolean",
          "enum": [
            0,
            1
          ],
          "example": 1
        },
        "duration": {
          "type": "integer",
          "example": 10
        },
        "rrule": {
          "$ref": "#/components/schemas/RRuleSchema"
        }
      }
    },
    "BillCodeRateRRuleCreateSchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/BillCodeRateRRuleBaseSchema"
        },
        {
          "type": "object",
          "required": [
            "rate",
            "order",
            "override_holiday_multiplicator"
          ]
        }
      ]
    },
    "BillCodeRateRRuleQuerySchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/BillCodeRateRRuleBaseSchema"
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 12
            }
          },
          "required": [
            "id",
            "rate",
            "external_id",
            "duration",
            "order",
            "override_holiday_multiplicator"
          ]
        }
      ]
    },
    "BillCodeRateRRuleUpdateSchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/BillCodeRateRRuleBaseSchema"
        }
      ]
    },
    "BillCodeRateTierQuerySchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/BillCodeRateTierCreateSchema"
        }
      ]
    },
    "BillCodeRateTierCreateSchema": {
      "type": "object",
      "properties": {
        "rate": {
          "description": "The rate to apply to the time period",
          "type": "number",
          "example": 12.5
        },
        "start_minute": {
          "description": "The minute the unit of time starts",
          "type": "integer",
          "example": 1,
          "minimum": 1
        },
        "end_minute": {
          "description": "The minute the unit of time ends",
          "type": "integer",
          "example": 59,
          "minimum": 2
        },
        "unit": {
          "description": "An integer representing the unit of time, this field should ascend in the same order as start_at\n",
          "type": "integer",
          "minimum": 1,
          "example": 1
        }
      },
      "required": [
        "rate",
        "start_at",
        "unit"
      ]
    },
    "BillCodeRateCreateSchema": {
      "type": "object",
      "properties": {
        "rate": {
          "type": "number",
          "example": 12.5
        },
        "external_id": {
          "type": "string",
          "example": "123"
        },
        "start_at": {
          "type": "string",
          "format": "date-time",
          "example": "2019-01-01T00:00:00+00:00",
          "description": "Date the Rate begins to apply"
        },
        "units": {
          "type": "string",
          "enum": [
            "hours",
            "visits",
            "rate"
          ]
        },
        "is_time_specific_rule_applicable": {
          "type": "boolean",
          "example": true
        },
        "rrules": {
          "$ref": "#/components/schemas/BillCodeRateRRuleCreateSchema"
        },
        "tiered_rates": {
          "$ref": "#/components/schemas/BillCodeRateTierCreateSchema"
        }
      },
      "required": [
        "rate",
        "units",
        "start_at"
      ]
    },
    "BillCodeRateUpdateSchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/BillCodeRateCreateSchema"
        },
        {
          "type": "object",
          "properties": {
            "tiered_rates": {
              "$ref": "#/components/schemas/BillCodeRateTierCreateSchema"
            }
          }
        }
      ]
    },
    "BillCodeRateQuerySchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/BillCodeRateCreateSchema"
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 12
            },
            "rrules": {
              "$ref": "#/components/schemas/BillCodeRateRRuleQuerySchema"
            },
            "tiered_rates": {
              "$ref": "#/components/schemas/BillCodeRateTierQuerySchema"
            }
          }
        }
      ],
      "required": [
        "id"
      ]
    },
    "BillCodeTaxSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 12
        },
        "name": {
          "type": "string",
          "example": "TPS"
        },
        "percent": {
          "type": "number",
          "example": 12.5
        }
      },
      "required": [
        "id",
        "name",
        "percent"
      ]
    },
    "BillCodeScalarQuerySchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/BillCodeCollectionQuerySchema"
        },
        {
          "type": "object",
          "properties": {
            "rates": {
              "type": "array",
              "items": {
                "type": "string",
                "example": "123"
              }
            },
            "taxes": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/BillCodeTaxSchema"
              }
            },
            "rounding_rule": {
              "$ref": "#/components/schemas/RoundingRuleSchema"
            },
            "modifier_rules": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ModifierRuleSetQuerySchema"
              }
            }
          }
        }
      ]
    },
    "RoundingRuleSchema": {
      "description": "The rounding rule that the Bill Code applies to a Visit's approved time",
      "type": "object",
      "properties": {
        "rounding_method": {
          "type": "string",
          "enum": [
            "DONT_ROUND",
            "UP",
            "DOWN",
            "NEAREST",
            "THRESHOLD"
          ]
        },
        "rounding_increment": {
          "type": "number"
        },
        "rounding_threshold": {
          "type": "integer",
          "minimum": 1,
          "maximum": 59
        },
        "rounding_rule": {
          "type": "integer",
          "enum": [
            1,
            2,
            3
          ],
          "x-enum-varnames": [
            "SCHEDULED",
            "CLOCKED",
            "START_END"
          ]
        },
        "is_breaks_included": {
          "type": "boolean"
        },
        "auto_update": {
          "type": "boolean"
        }
      }
    },
    "BillCodeUpdateBaseSchema": {
      "type": "object",
      "properties": {
        "gl_revenue_id": {
          "type": "integer",
          "example": 1
        },
        "rates": {
          "description": "Rates associated with the Billcode",
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/BillCodeRateCreateSchema"
          }
        },
        "funder_id": {
          "type": "integer",
          "example": 1
        },
        "taxes": {
          "description": "Taxes associated with the Billcode",
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/LinkedEntitySchema"
          }
        },
        "rounding_rule": {
          "$ref": "#/components/schemas/RoundingRuleSchema"
        },
        "modifier_rules": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/LinkedEntitySchema"
          }
        }
      }
    },
    "BillCodeUpdateSchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/BillCodeBaseSchema"
        },
        {
          "$ref": "#/components/schemas/BillCodeUpdateBaseSchema"
        },
        {
          "type": "object",
          "properties": {
            "rates": {
              "description": "Rates can be provided here for validation only",
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/BillCodeRateCreateSchema"
              }
            }
          }
        }
      ]
    },
    "BillCodeCreateSchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/BillCodeBaseSchema"
        },
        {
          "$ref": "#/components/schemas/BillCodeUpdateBaseSchema"
        },
        {
          "type": "object",
          "properties": {
            "branch_id": {
              "type": "integer",
              "description": "ID of the branch the Billcode belongs to"
            }
          }
        }
      ],
      "required": [
        "code",
        "name",
        "units",
        "bill_clocked_time",
        "send_decimal_units",
        "rates"
      ]
    },
    "BillCodeBaseSchema": {
      "type": "object",
      "properties": {
        "code": {
          "description": "Billing code",
          "type": "string",
          "example": "Code"
        },
        "name": {
          "description": "Billcode name",
          "type": "string",
          "example": "Name"
        },
        "excluded_from_billing": {
          "description": "Flag indicating if the Billcode is excluded from billing",
          "type": "boolean",
          "example": true
        },
        "is_midnight_rule_applicable": {
          "description": "Flag indicating if the midnight rule applies to this Billcode",
          "type": "boolean",
          "example": true
        },
        "billing_increment": {
          "type": "integer",
          "example": 15
        },
        "location_indicator": {
          "type": "string",
          "example": "12"
        },
        "revenue_code": {
          "type": "string",
          "example": "12345"
        },
        "revenue_code_description": {
          "type": "string",
          "example": "Lorem Ipsum"
        },
        "value_code": {
          "type": "string",
          "example": "D5"
        },
        "value_code_amount": {
          "type": "string",
          "example": 22.5
        },
        "bill_using": {
          "type": "string",
          "enum": [
            "scheduled_start_time_of_visit",
            "scheduled_end_time_of_visit",
            "scheduled_calculated_end_time_of_visit"
          ]
        },
        "units": {
          "type": "string",
          "enum": [
            "hours",
            "visits",
            "rate"
          ]
        },
        "evv_service_group": {
          "type": "string",
          "example": "1234"
        },
        "evv_rate_code": {
          "description": "Electronic Visit Verification Rate Code",
          "type": "string",
          "example": 23
        },
        "evv_payor_program_code": {
          "description": "Electronic Visit Verification Payor Program Code",
          "type": "string",
          "example": 23
        },
        "evv_category": {
          "description": "Electronic Visit Verification Category",
          "type": "string",
          "example": "Lorem Ipsum"
        },
        "bill_clocked_time": {
          "description": "Bill Code bills against clocked time",
          "type": "boolean",
          "example": true
        },
        "send_decimal_units": {
          "description": "Determines whether quantity for service lines are determined during claim generation\nor during bank calculation\n",
          "type": "boolean",
          "example": true
        }
      }
    },
    "BillCodeCollectionQuerySchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/BillCodeBaseSchema"
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "description": "Bill Code ID",
              "type": "integer",
              "example": 12
            },
            "is_disabled": {
              "description": "Flag indicating if the Billcode is disabled",
              "type": "boolean",
              "example": false
            },
            "funder": {
              "$ref": "#/components/schemas/FunderStubSchema"
            },
            "is_read_only": {
              "description": "Flag indicating if the Billcode is read only",
              "type": "boolean",
              "example": false
            },
            "guid": {
              "description": "Globally Unique Identifier",
              "type": "integer",
              "example": 12
            },
            "gl_revenue": {
              "$ref": "#/components/schemas/AccountStub"
            },
            "branch": {
              "$ref": "#/components/schemas/BranchSchema"
            }
          }
        }
      ],
      "required": [
        "id",
        "code",
        "name",
        "excluded_from_billing",
        "is_midnight_rule_applicable",
        "is_disabled"
      ]
    },
    "ModifierRuleSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 12,
          "minimum": 1
        },
        "code": {
          "type": "string",
          "example": "code"
        },
        "rule_type": {
          "type": "integer",
          "example": 1
        }
      }
    },
    "ModifierRuleSetQuerySchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 12,
          "minimum": 1
        },
        "name": {
          "type": "string",
          "example": "modifer_rule_name"
        },
        "description": {
          "type": "string",
          "example": "A rule that modifies"
        },
        "branch_id": {
          "type": "integer",
          "example": 1
        },
        "type": {
          "type": "integer",
          "example": 1
        },
        "rules": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ModifierRuleSchema"
          }
        }
      }
    },
    "FunderStubSchema": {
      "description": "Funder associated with the Billcode",
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 12,
          "minimum": 1
        },
        "name": {
          "type": "string",
          "example": "Funder"
        }
      }
    },
    "TransactionSchema": {
      "type": "object",
      "description": "A representation of an accounting transaction",
      "readOnly": true,
      "properties": {
        "id": {
          "type": "integer",
          "format": "int64",
          "description": "Reference ID"
        },
        "posting_date": {
          "type": "string",
          "format": "date",
          "description": "Posting date in the `YYYY-MM-DD` format"
        },
        "type": {
          "$ref": "#/components/schemas/TransactionType"
        },
        "amount": {
          "type": "number",
          "format": "float",
          "description": "The amout of the transaction."
        },
        "unallocated_amount": {
          "type": "number",
          "format": "float",
          "description": "The unallocated amount of the transaction."
        },
        "allocations_count": {
          "type": "integer",
          "format": "int64",
          "description": "The number of allocations that this transaction has"
        },
        "invoice_id": {
          "type": "integer",
          "format": "int64",
          "description": "The id of the invoice associated to the transaction; Applicable for transactions of type sale, void and credit/debit notes."
        },
        "invoice_number": {
          "type": "integer",
          "format": "int64",
          "description": "The invoice item id of the invoice item associated to the transaction; Applicable for transactions of type sale, void and credit/debit notes."
        },
        "invoice_item_id": {
          "type": "integer",
          "format": "int64",
          "description": "The invoice number of the invoice associated to the transaction; Applicable for transactions of type sale, void and credit/debit notes."
        },
        "budget_id": {
          "type": "integer",
          "format": "int64",
          "description": "The budget id of the budget associated to the transaction"
        },
        "memo": {
          "type": "string",
          "description": "A note about the transaction."
        },
        "payment_is_canceled": {
          "type": "boolean",
          "description": "whether or not the payment is canceled (currently always false)",
          "example": true
        },
        "is_adjustable": {
          "type": "boolean",
          "description": "whether or not adjustment transaction types exist for this transaction",
          "example": true
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "client": {
          "$ref": "#/components/schemas/ClientShortSchema"
        },
        "funder": {
          "$ref": "#/components/schemas/FunderShortSchema"
        },
        "billing_contact": {
          "$ref": "#/components/schemas/BillingContactShortSchema"
        },
        "create_user": {
          "$ref": "#/components/schemas/UserShortSchema"
        },
        "adjustments": {
          "$ref": "#/components/schemas/TransactionAdjustmentSchema"
        },
        "billing_period_id": {
          "type": "integer",
          "minimum": 1,
          "description": "The id of the billing period associated to the transaction"
        }
      }
    },
    "TransactionExtendedSchema": {
      "allOf": [
        {
          "$ref": "#/components/schemas/TransactionSchema"
        },
        {
          "type": "object",
          "properties": {
            "entries": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/TransactionEntrySchema"
              }
            },
            "visits": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/VisitSchema"
              }
            }
          }
        }
      ]
    },
    "VisitSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "minimum": 1
        },
        "start_time": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "TransactionType": {
      "description": "Transaction type",
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "format": "int64",
          "description": "The id of the transaction type"
        },
        "name": {
          "type": "string",
          "description": "The name of transaction type"
        },
        "AR_entry": {
          "type": "string",
          "description": "The entry type",
          "enum": [
            "credit",
            "debit"
          ]
        },
        "is_disabled": {
          "type": "boolean",
          "description": "True if no transaction of that type can be created by the user; False if not"
        },
        "is_custom": {
          "type": "boolean",
          "description": "True if this type is custom (was created by the user); False if not"
        }
      }
    },
    "ClientShortSchema": {
      "type": "object",
      "description": "A client",
      "properties": {
        "id": {
          "type": "integer",
          "format": "int64",
          "description": "The ID of the client"
        },
        "name": {
          "type": "string",
          "description": "The name of the client"
        },
        "alayacare_id": {
          "type": "string",
          "description": "The AlayaCare ID of the client"
        }
      },
      "example": {
        "id": 1,
        "name": "Peter Tosh",
        "alayacare_id": "AC000000123"
      }
    },
    "FunderShortSchema": {
      "type": "object",
      "description": "A funder",
      "properties": {
        "id": {
          "type": "integer",
          "format": "int64",
          "description": "The ID of the funder"
        },
        "code": {
          "type": "string",
          "description": "The code of the funder"
        },
        "name": {
          "type": "string",
          "description": "The name of the funder"
        },
        "invoicing_model": {
          "type": "string",
          "description": "The invoicing model of the funder"
        }
      }
    },
    "BillingContactShortSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "format": "int64",
          "description": "The ID of the billing contact"
        },
        "full_name": {
          "type": "string",
          "description": "The full name of the billing contact"
        }
      }
    },
    "UserShortSchema": {
      "type": "object",
      "description": "A user",
      "properties": {
        "id": {
          "type": "integer",
          "format": "int64",
          "description": "The ID of the user"
        },
        "name": {
          "type": "string",
          "description": "The name of the user"
        }
      }
    },
    "TransactionAdjustmentSchema": {
      "type": "object",
      "properties": {
        "total_credit": {
          "type": "number",
          "format": "float",
          "description": "description"
        },
        "total_debit": {
          "type": "number",
          "format": "float",
          "description": "description"
        }
      }
    },
    "TransactionEntrySchema": {
      "type": "object",
      "properties": {
        "account": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer"
            },
            "account": {
              "$ref": "#/components/schemas/AccountSchema"
            },
            "debit": {
              "type": "number",
              "format": "float"
            },
            "credit": {
              "type": "number",
              "format": "float"
            },
            "cost_centre": {
              "$ref": "#/components/schemas/CostCentreScalarSchema"
            }
          }
        }
      }
    },
    "CostCentreScalarSchema": {
      "description": "A cost centre",
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "example": 1
        },
        "number": {
          "type": "string",
          "example": "MTL-032"
        },
        "description": {
          "type": "string",
          "example": "A cost centre"
        }
      }
    },
    "AccountSchema": {
      "type": "object",
      "description": "A representation of a General Ledger account",
      "properties": {
        "id": {
          "type": "integer",
          "description": "The ID the GL account"
        },
        "name": {
          "type": "string",
          "description": "The name of the GL account"
        },
        "type": {
          "type": "string",
          "description": "The type of the GL account"
        },
        "is_disabled": {
          "type": "boolean",
          "description": "Whether this GL account is disabled."
        },
        "gl_number": {
          "type": "integer",
          "description": "The account number on the General Ledger."
        }
      },
      "example": {
        "id": 2,
        "name": "Revenue - Product A",
        "type": "Revenue",
        "is_disabled": false,
        "gl_number": 4002
      }
    }
  }
}