{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/maesn/main/json-schema/maesn-bill-response-dto-schema.json",
  "title": "BillResponseDto",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/maesn-openapi.json#/components/schemas/BillResponseDto",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "accountId": {
      "type": "string"
    },
    "addresses": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Address"
      }
    },
    "billDate": {
      "type": "string"
    },
    "billNumber": {
      "type": "string"
    },
    "contactId": {
      "type": "string"
    },
    "createdDate": {
      "type": "string"
    },
    "currency": {
      "type": "string",
      "enum": [
        "AED",
        "AFN",
        "ALL",
        "AMD",
        "ANG",
        "AOA",
        "ARS",
        "AUD",
        "AWG",
        "AZN",
        "BAM",
        "BBD",
        "BDT",
        "BGN",
        "BHD",
        "BIF",
        "BMD",
        "BND",
        "BOB",
        "BRL",
        "BSD",
        "BTN",
        "BWP",
        "BYR",
        "BZD",
        "CAD",
        "CDF",
        "CHF",
        "CLP",
        "CNY",
        "COP",
        "CRC",
        "CUC",
        "CVE",
        "CZK",
        "DJF",
        "DKK",
        "DOP",
        "DZD",
        "EEK",
        "EGP",
        "ERN",
        "ETB",
        "EUR",
        "FJD",
        "FKP",
        "GBP",
        "GEL",
        "GHS",
        "GIP",
        "GMD",
        "GNF",
        "GQE",
        "GTQ",
        "GYD",
        "HKD",
        "HNL",
        "HRK",
        "HTG",
        "HUF",
        "IDR",
        "ILS",
        "INR",
        "IQD",
        "IRR",
        "ISK",
        "JMD",
        "JOD",
        "JPY",
        "KES",
        "KGS",
        "KHR",
        "KMF",
        "KPW",
        "KRW",
        "KWD",
        "KYD",
        "KZT",
        "LAK",
        "LBP",
        "LKR",
        "LRD",
        "LSL",
        "LTL",
        "LVL",
        "LYD",
        "MAD",
        "MDL",
        "MGA",
        "MKD",
        "MMK",
        "MNT",
        "MOP",
        "MRO",
        "MUR",
        "MVR",
        "MWK",
        "MXN",
        "MYR",
        "MZM",
        "NAD",
        "NGN",
        "NIO",
        "NOK",
        "NPR",
        "NZD",
        "OMR",
        "PAB",
        "PEN",
        "PGK",
        "PHP",
        "PKR",
        "PLN",
        "PYG",
        "QAR",
        "RON",
        "RSD",
        "RUB",
        "SAR",
        "SBD",
        "SCR",
        "SDG",
        "SEK",
        "SGD",
        "SHP",
        "SLL",
        "SOS",
        "SRD",
        "SYP",
        "SZL",
        "THB",
        "TJS",
        "TMT",
        "TND",
        "TRY",
        "TTD",
        "TWD",
        "TZS",
        "UAH",
        "UGX",
        "USD",
        "UYU",
        "UZS",
        "VEB",
        "VND",
        "VUV",
        "WST",
        "XAF",
        "XCD",
        "XDR",
        "XOF",
        "XPF",
        "YER",
        "ZAR",
        "ZMK",
        "ZWR"
      ]
    },
    "deliveryDate": {
      "type": "string"
    },
    "dueDate": {
      "type": "string"
    },
    "fileId": {
      "type": "string"
    },
    "journalCode": {
      "type": "string"
    },
    "lineItems": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/BillLineItem"
      }
    },
    "name": {
      "type": "string"
    },
    "oneLineAddress": {
      "type": "string"
    },
    "paidDate": {
      "type": "string"
    },
    "paymentDays": {
      "type": "number"
    },
    "paymentReference": {
      "type": "string"
    },
    "paymentStatus": {
      "description": "Best-effort payment/open-item status. Only populated by some source systems; `null` for all others. Prefer `status` for reliable lifecycle logic, and always handle the `null` case. See [Document status fields](/standardization#document-status-fields).",
      "type": "string",
      "enum": [
        "NO_OPEN_ITEM",
        "PENDING",
        "PAID",
        "PARTLY_PAID",
        "CANCELED",
        "PARTIAL_CANCELLATION",
        "BAD_DEBT",
        "DEBITED",
        "CREDIT_NOTE_CLEARED",
        "CLEARED_WITH_CREDIT_NOTE",
        "UNKNOWN"
      ]
    },
    "paymentTermCode": {
      "type": "string"
    },
    "reference": {
      "type": "string"
    },
    "shippingDate": {
      "type": "string"
    },
    "shippingType": {
      "type": "string",
      "enum": [
        "SERVICE",
        "SERVICE_PERIOD",
        "DELIVERY",
        "DELIVERY_PERIOD"
      ]
    },
    "status": {
      "description": "The document's lifecycle status, populated across all source systems. Use this as the authoritative state for lifecycle and paid/unpaid logic; prefer it over the best-effort `paymentStatus`. See [Document status fields](/standardization#document-status-fields).",
      "type": "string",
      "enum": [
        "DRAFT",
        "CORRECTIVE",
        "SUBMITTED",
        "DOCUMENT_CREATED",
        "OPEN",
        "PARTIALLY_PAID",
        "PAID",
        "PARTIALLY_OVERDUE",
        "OVERDUE",
        "VOIDED"
      ]
    },
    "taxRule": {
      "type": "string",
      "enum": [
        "NET",
        "TAXFREE",
        "INTRACOMMUNITY_GOODS",
        "INTRACOMMUNITY_SERVICE",
        "EXPORT_SERVICE",
        "EXPORT_GOODS",
        "REVERSE_CHARGE",
        "GROSS",
        "CONSTRUCTION_SERVICE",
        "PHOTOVOLTAIC_EQUIPMENT",
        "SMALL_BUSINESS_VAT_EXEMPTION",
        "NON_DOMESTIC_SERVICE",
        "OSS_GOODS",
        "OSS_ELECTRONIC_SERVICES",
        "OSS_SERVICES"
      ]
    },
    "taxText": {
      "type": "string"
    },
    "totalDiscountAmount": {
      "description": "Total discount applied, in the document currency.",
      "type": "number"
    },
    "totalDiscountPercentage": {
      "description": "Total discount applied, as a percentage.",
      "type": "number"
    },
    "totalGrossAmount": {
      "description": "Gross total — the net amount plus tax (the total payable, including VAT).",
      "type": "number"
    },
    "totalNetAmount": {
      "description": "Net total — the sum of all line amounts before tax (excluding VAT).",
      "type": "number"
    },
    "totalTaxAmount": {
      "description": "Tax (VAT) total — the difference between the gross and net totals.",
      "type": "number"
    },
    "updatedDate": {
      "type": "string"
    }
  },
  "$defs": {
    "Address": {
      "type": "object",
      "properties": {
        "addressLine1": {
          "type": "string"
        },
        "addressLine2": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "countryCode": {
          "type": "string",
          "enum": [
            "AD",
            "AE",
            "AF",
            "AG",
            "AI",
            "AL",
            "AM",
            "AO",
            "AQ",
            "AR",
            "AS",
            "AT",
            "AU",
            "AW",
            "AX",
            "AZ",
            "BA",
            "BB",
            "BD",
            "BE",
            "BF",
            "BG",
            "BH",
            "BI",
            "BJ",
            "BL",
            "BM",
            "BN",
            "BO",
            "BQ",
            "BR",
            "BS",
            "BT",
            "BV",
            "BW",
            "BY",
            "BZ",
            "CA",
            "CC",
            "CD",
            "CF",
            "CG",
            "CH",
            "CI",
            "CK",
            "CL",
            "CM",
            "CN",
            "CO",
            "CR",
            "CU",
            "CV",
            "CW",
            "CX",
            "CY",
            "CZ",
            "DE",
            "DJ",
            "DK",
            "DM",
            "DO",
            "DZ",
            "EC",
            "EE",
            "EG",
            "EH",
            "ER",
            "ES",
            "ET",
            "FI",
            "FJ",
            "FK",
            "FM",
            "FO",
            "FR",
            "GA",
            "GB",
            "GD",
            "GE",
            "GF",
            "GG",
            "GH",
            "GI",
            "GL",
            "GM",
            "GN",
            "GP",
            "GQ",
            "GR",
            "GS",
            "GT",
            "GU",
            "GW",
            "GY",
            "HK",
            "HM",
            "HN",
            "HR",
            "HT",
            "HU",
            "ID",
            "IE",
            "IL",
            "IM",
            "IN",
            "IO",
            "IQ",
            "IR",
            "IS",
            "IT",
            "JE",
            "JM",
            "JO",
            "JP",
            "KE",
            "KG",
            "KH",
            "KI",
            "KM",
            "KN",
            "KP",
            "KR",
            "KW",
            "KY",
            "KZ",
            "LA",
            "LB",
            "LC",
            "LI",
            "LK",
            "LR",
            "LS",
            "LT",
            "LU",
            "LV",
            "LY",
            "MA",
            "MC",
            "MD",
            "ME",
            "MF",
            "MG",
            "MH",
            "MK",
            "ML",
            "MM",
            "MN",
            "MO",
            "MP",
            "MQ",
            "MR",
            "MS",
            "MT",
            "MU",
            "MV",
            "MW",
            "MX",
            "MY",
            "MZ",
            "NA",
            "NC",
            "NE",
            "NF",
            "NG",
            "NI",
            "NL",
            "NO",
            "NP",
            "NR",
            "NU",
            "NZ",
            "OM",
            "PA",
            "PE",
            "PF",
            "PG",
            "PH",
            "PK",
            "PL",
            "PM",
            "PN",
            "PR",
            "PT",
            "PW",
            "PY",
            "QA",
            "RE",
            "RO",
            "RS",
            "RU",
            "RW",
            "SA",
            "SB",
            "SC",
            "SD",
            "SE",
            "SG",
            "SH",
            "SI",
            "SJ",
            "SK",
            "SL",
            "SM",
            "SN",
            "SO",
            "SR",
            "SS",
            "ST",
            "SV",
            "SX",
            "SY",
            "SZ",
            "TC",
            "TD",
            "TF",
            "TG",
            "TH",
            "TJ",
            "TK",
            "TL",
            "TM",
            "TN",
            "TO",
            "TR",
            "TT",
            "TV",
            "TW",
            "TZ",
            "UA",
            "UG",
            "UM",
            "US",
            "UY",
            "UZ",
            "VA",
            "VC",
            "VE",
            "VG",
            "VI",
            "VN",
            "VU",
            "WF",
            "WS",
            "YE",
            "YT",
            "ZA",
            "ZM",
            "ZW"
          ]
        },
        "postalCode": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "BILLING",
            "DELIVERY",
            "SELLING"
          ]
        }
      }
    },
    "BillLineItem": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "accountId": {
          "type": "string"
        },
        "accountNumber": {
          "type": "string"
        },
        "createdDate": {
          "type": "string"
        },
        "deferredEndDate": {
          "type": "string"
        },
        "deferredStartDate": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "dimensions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LineItemDimension"
          }
        },
        "itemId": {
          "type": "string"
        },
        "itemName": {
          "type": "string"
        },
        "quantity": {
          "type": "number"
        },
        "taxCode": {
          "type": "string"
        },
        "taxRatePercentage": {
          "type": "number"
        },
        "totalDiscountAmount": {
          "description": "Discount applied to the line item, in the document currency.",
          "type": "number"
        },
        "totalDiscountPercentage": {
          "description": "Discount applied to the line item, as a percentage.",
          "type": "number"
        },
        "totalGrossAmount": {
          "description": "Gross amount of the line item — net plus tax (including VAT).",
          "type": "number"
        },
        "totalNetAmount": {
          "description": "Net amount of the line item — before tax (excluding VAT).",
          "type": "number"
        },
        "totalTaxAmount": {
          "description": "Tax (VAT) amount of the line item.",
          "type": "number"
        },
        "unitAmount": {
          "description": "Price per unit, in the document currency.",
          "type": "number"
        },
        "unitDiscountAmount": {
          "description": "Discount applied per unit, in the document currency.",
          "type": "number"
        },
        "unitDiscountPercentage": {
          "description": "Discount applied per unit, as a percentage.",
          "type": "number"
        },
        "unitName": {
          "type": "string"
        },
        "updatedDate": {
          "type": "string"
        }
      }
    },
    "LineItemDimension": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "categoryName": {
          "type": "string"
        }
      }
    }
  }
}