{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "schema:Invoice",
  "title": "Invoice",
  "description": "A statement of the money due for goods or services; a bill.",
  "type": "object",
  "allOf": [
    {
      "description": "A utility class that serves as the umbrella for a number of 'intangible' things such as quantities, structured values, etc.",
      "$ref": "schema:Intangible"
    }
  ],
  "properties": {
    "accountId": {
      "description": "The identifier for the account the payment will be applied to.",
      "type": "string"
    },
    "billingPeriod": {
      "description": "The time interval used to compute the invoice.",
      "type": "string",
      "$comment": "https://schema.org/Duration"
    },
    "broker": {
      "description": "An entity that arranges for an exchange between a buyer and a seller.  In most cases a broker never acquires or releases ownership of a product or service involved in an exchange.  If it is not clear whether an entity is a broker, seller, or buyer, the latter two terms are preferred.",
      "oneOf": [
        {
          "anyOf": [
            { "$ref": "schema:Organization" },
            { "$ref": "schema:Person" }
          ]
        },
        {
          "type": "array",
          "items": {
            "anyOf": [
              { "$ref": "schema:Organization" },
              { "$ref": "schema:Person" }
            ]
          }
        }
      ]
    },
    "category": {
      "description": "A category for the item. Greater signs or slashes can be used to informally indicate a category hierarchy.",
      "oneOf": [
        {
          "anyOf": [
            { "type": "string", "format": "uri" },
            { "type": "string" },
            { "$ref": "schema:CategoryCode" },
            { "$ref": "schema:PhysicalActivityCategory" },
            { "$ref": "schema:Thing" }
          ]
        },
        {
          "type": "array",
          "items": {
            "anyOf": [
              { "type": "string", "format": "uri" },
              { "type": "string" },
              { "$ref": "schema:CategoryCode" },
              { "$ref": "schema:PhysicalActivityCategory" },
              { "$ref": "schema:Thing" }
            ]
          }
        }
      ]
    },
    "confirmationNumber": {
      "description": "A number that confirms the given order or payment has been received.",
      "type": "string"
    },
    "customer": {
      "description": "Party placing the order or paying the invoice.",
      "anyOf": [{ "$ref": "schema:Organization" }, { "$ref": "schema:Person" }]
    },
    "minimumPaymentDue": {
      "description": "The minimum payment required at this time.",
      "anyOf": [
        { "$ref": "schema:MonetaryAmount" },
        { "$ref": "schema:PriceSpecification" }
      ]
    },
    "paymentDue": {
      "description": "The date that payment is due.",
      "type": "string",
      "format": "date-time"
    },
    "paymentDueDate": {
      "description": "The date that payment is due.",
      "anyOf": [
        { "type": "string", "format": "date" },
        { "type": "string", "format": "date-time" }
      ]
    },
    "paymentMethod": {
      "description": "The name of the credit card or other method of payment for the order.",
      "anyOf": [{ "type": "string" }, { "$ref": "schema:PaymentMethod" }]
    },
    "paymentMethodId": {
      "description": "An identifier for the method of payment used (e.g. the last 4 digits of the credit card).",
      "oneOf": [
        { "type": "string" },
        { "type": "array", "items": { "type": "string" } }
      ]
    },
    "paymentStatus": {
      "description": "The status of payment; whether the invoice has been paid or not.",
      "anyOf": [{ "type": "string" }, { "$ref": "schema:PaymentStatusType" }]
    },
    "provider": {
      "description": "The service provider, service operator, or service performer; the goods producer. Another party (a seller) may offer those services or goods on behalf of the provider. A provider may also serve as the seller.",
      "anyOf": [{ "$ref": "schema:Organization" }, { "$ref": "schema:Person" }]
    },
    "referencesOrder": {
      "description": "The Order(s) related to this Invoice. One or more Orders may be combined into a single Invoice.",
      "$ref": "schema:Order"
    },
    "scheduledPaymentDate": {
      "description": "The date the invoice is scheduled to be paid.",
      "type": "string",
      "format": "date"
    },
    "totalPaymentDue": {
      "description": "The total amount due.",
      "anyOf": [
        { "$ref": "schema:MonetaryAmount" },
        { "$ref": "schema:PriceSpecification" }
      ]
    }
  }
}
