{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://objectsgrid.com/.well-known/objects-catalog/Invoice/v1/schema.json",
  "title": "Invoice",
  "description": "Objects Grid Invoice Object. A statement of the money due for goods or services. A private record of a customer: it has no JSON-LD document. Modeled in compliance with https://schema.org/Invoice.",
  "x-objectsgrid-jsonLd": false,
  "type": "object",
  "properties": {
    "at_context": {
      "description": "Schema context",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "https://schema.org"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "at_type": {
      "description": "The object type",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "Invoice"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "at_id": {
      "description": "This Invoice's ObjectsGrid URL, https://apis.objectsgrid.com/<path>/<id>: its JSON-LD @id, which References point to. Set by the service.",
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "readOnly": true
    },
    "id": {
      "description": "The unique identifier for Invoice. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 0,
      "maxLength": 50,
      "readOnly": true
    },
    "identifier": {
      "description": "The unique identifier for Invoice. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 0,
      "maxLength": 50,
      "readOnly": true
    },
    "description": {
      "description": "The Invoice description",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/LanguageTaggedString/v1/schema.json"
      }
    },
    "url": {
      "description": "This Invoice URL. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "minLength": 1,
      "readOnly": true
    },
    "accountId": {
      "description": "The identifier of the customer's account the invoice is for",
      "type": [
        "string",
        "null"
      ]
    },
    "billingPeriod": {
      "description": "The period the invoice covers, as an ISO 8601 duration, e.g. 'P1M'",
      "type": [
        "string",
        "null"
      ],
      "minLength": 3,
      "pattern": "^P(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?(T(\\d+H)?(\\d+M)?(\\d+(\\.\\d+)?S)?)?$"
    },
    "confirmationNumber": {
      "description": "A number that confirms the payment has been received",
      "type": [
        "string",
        "null"
      ]
    },
    "minimumPaymentDue": {
      "description": "The minimum payment due",
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/MonetaryAmount/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "paymentDueDate": {
      "description": "The date that payment is due",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "paymentMethod": {
      "description": "The name of the payment method used (e.g. 'Credit Card', 'PayPal')",
      "type": [
        "string",
        "null"
      ]
    },
    "paymentMethodId": {
      "description": "An identifier for the method of payment used (e.g. the last 4 digits of the credit card)",
      "type": [
        "string",
        "null"
      ]
    },
    "paymentStatus": {
      "description": "The status of the payment",
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/PaymentStatusType/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "scheduledPaymentDate": {
      "description": "The date the invoice is scheduled to be paid",
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "totalPaymentDue": {
      "description": "The total amount due",
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/MonetaryAmount/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "customer": {
      "x-objectsgrid-erasure": "keep",
      "x-objectsgrid-version": "pinned",
      "description": "Party paying the invoice: the URL of a Person or Organization, stored as <url>?version=<objectVersion>, the version that was newest when the Invoice was written, so the Invoice shows the customer as they were.",
      "x-objectsgrid-rangeIncludes": [
        "Person",
        "Organization"
      ],
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "provider": {
      "x-objectsgrid-erasure": "keep",
      "description": "The party issuing the invoice",
      "x-objectsgrid-rangeIncludes": [
        "Organization",
        "Person"
      ],
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "broker": {
      "x-objectsgrid-erasure": "keep",
      "description": "An entity that arranges for an exchange between a buyer and a seller",
      "x-objectsgrid-rangeIncludes": [
        "Organization",
        "Person"
      ],
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "referencesOrder": {
      "description": "The Orders the invoice is for",
      "x-objectsgrid-rangeIncludes": [
        "Order"
      ],
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
      },
      "maxItems": 100
    },
    "tags": {
      "description": "Tags an ABAC policy can decide on. A name may repeat; the same name and value appear once. Every stored object has them: created empty when not sent, kept by a replacement (PUT) that does not mention them, unchanged by a patch that does not mention them, cleared by null or [].",
      "type": "array",
      "default": [],
      "uniqueItems": true,
      "maxItems": 50,
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Tag/v1/schema.json"
      }
    },
    "meta": {
      "description": "System-managed metadata for the object (version, audit fields). Assigned by the server.",
      "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ObjectMeta/v1/schema.json",
      "readOnly": true
    },
    "payments": {
      "description": "The payments and refunds of it. ObjectsGrid's own field. Computed, read-only: the objects whose PayAction.object points to this object, listed from that type; never stored or written.",
      "x-objectsgrid-inverseOf": "PayAction.object",
      "readOnly": true
    }
  },
  "required": [
    "customer",
    "provider"
  ],
  "unevaluatedProperties": false
}
