{
  "$defs": {
    "FuelAccountBalance": {
      "description": "FuelAccountBalance carries the data to produce a CFDI's \"Complemento de Estado de Cuenta de Combustibles para Monederos Electr\u00f3nicos\" (version 1.2 revision B) providing detailed information about fuel purchases made with electronic wallets.",
      "properties": {
        "account_number": {
          "description": "Customer's account number (maps to `NumeroDeCuenta`).",
          "title": "Account Number",
          "type": "string"
        },
        "lines": {
          "description": "List of fuel purchases made with the customer's e-wallets (maps to `Conceptos`).",
          "items": {
            "$ref": "#/$defs/FuelAccountLine"
          },
          "title": "Lines",
          "type": "array"
        },
        "subtotal": {
          "$ref": "https://gobl.org/draft-0/num/amount",
          "calculated": true,
          "description": "Sum of all line totals (i.e. taxes not included) (calculated, maps to `SubTotal`).",
          "title": "Subtotal"
        },
        "total": {
          "$ref": "https://gobl.org/draft-0/num/amount",
          "calculated": true,
          "description": "Grand total after taxes have been applied (calculated, maps to `Total`).",
          "title": "Total"
        }
      },
      "required": [
        "account_number",
        "subtotal",
        "total",
        "lines"
      ],
      "type": "object"
    },
    "FuelAccountItem": {
      "description": "FuelAccountItem provides the details of a fuel purchase.",
      "properties": {
        "name": {
          "description": "Name of the fuel (maps to `NombreCombustible`).",
          "title": "Name",
          "type": "string"
        },
        "price": {
          "$ref": "https://gobl.org/draft-0/num/amount",
          "description": "Base price of a single unit of the fuel without taxes (maps to `ValorUnitario`).",
          "title": "Price"
        },
        "type": {
          "$ref": "https://gobl.org/draft-0/cbc/code",
          "description": "Type of fuel (one of `c_ClaveTipoCombustible` codes, maps to `TipoCombustible`).",
          "title": "Type"
        },
        "unit": {
          "$ref": "https://gobl.org/draft-0/org/unit",
          "description": "Reference unit of measure used in the price and the quantity (maps to `Unidad`).",
          "title": "Unit"
        }
      },
      "required": [
        "type",
        "name",
        "price"
      ],
      "type": "object"
    },
    "FuelAccountLine": {
      "description": "FuelAccountLine represents a single fuel purchase made with an e-wallet issued by the invoice's supplier.",
      "properties": {
        "e_wallet_id": {
          "$ref": "https://gobl.org/draft-0/cbc/code",
          "description": "Identifier of the e-wallet used to make the purchase (maps to `Identificador`).",
          "title": "E-wallet Identifier"
        },
        "item": {
          "$ref": "#/$defs/FuelAccountItem",
          "description": "Details of the fuel purchased.",
          "title": "Item"
        },
        "purchase_code": {
          "$ref": "https://gobl.org/draft-0/cbc/code",
          "description": "Identifier of the purchase (maps to `FolioOperacion`).",
          "title": "Purchase Code"
        },
        "purchase_date_time": {
          "$ref": "https://gobl.org/draft-0/cal/date-time",
          "description": "Date and time of the purchase (maps to `Fecha`).",
          "title": "Purchase Date and Time"
        },
        "quantity": {
          "$ref": "https://gobl.org/draft-0/num/amount",
          "description": "Amount of fuel units purchased (maps to `Cantidad`)",
          "title": "Quantity"
        },
        "service_station_code": {
          "$ref": "https://gobl.org/draft-0/cbc/code",
          "description": "Code of the service station where the purchase was made (maps to `ClaveEstacion`).",
          "title": "Service Station Code"
        },
        "taxes": {
          "description": "Map of taxes applied to the purchase (maps to `Traslados`).",
          "items": {
            "$ref": "#/$defs/FuelAccountTax"
          },
          "title": "Taxes",
          "type": "array"
        },
        "total": {
          "$ref": "https://gobl.org/draft-0/num/amount",
          "description": "Result of quantity multiplied by the unit price (maps to `Importe`).",
          "title": "Total"
        },
        "vendor_tax_code": {
          "$ref": "https://gobl.org/draft-0/cbc/code",
          "description": "Tax Identity Code of the fuel's vendor (maps to `Rfc`)",
          "title": "Vendor's Tax Identity Code"
        }
      },
      "required": [
        "e_wallet_id",
        "purchase_date_time",
        "vendor_tax_code",
        "service_station_code",
        "quantity",
        "item",
        "purchase_code",
        "total",
        "taxes"
      ],
      "type": "object"
    },
    "FuelAccountTax": {
      "description": "FuelAccountTax represents a single tax applied to a fuel purchase.",
      "properties": {
        "amount": {
          "$ref": "https://gobl.org/draft-0/num/amount",
          "description": "Total amount of the tax once the rate has been applied (maps to `Importe`).",
          "title": "Amount"
        },
        "code": {
          "$ref": "https://gobl.org/draft-0/cbc/code",
          "description": "Code that identifies the tax (\"IVA\" or \"IEPS\", maps to `Impuesto`)",
          "title": "Code"
        },
        "rate": {
          "$ref": "https://gobl.org/draft-0/num/amount",
          "description": "Rate applicable to either the line total (tasa) or the line quantity (cuota) (maps to `TasaOCuota`).",
          "title": "Rate"
        }
      },
      "required": [
        "code",
        "rate",
        "amount"
      ],
      "type": "object"
    }
  },
  "$id": "https://gobl.org/draft-0/regimes/mx/fuel-account-balance",
  "$ref": "#/$defs/FuelAccountBalance",
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}