{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/grainfinance-co/json-schema/grainfinance-co-customer-schema.json",
  "title": "Customer",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/grainfinance-co-customers-api-openapi.yml#/components/schemas/Customer",
  "properties": {
    "id": {
      "$ref": "#/$defs/UUID",
      "description": "The id of the customer within the Grain platform."
    },
    "companyName": {
      "type": "string",
      "description": "The legal name of the customer's company"
    },
    "companyAddress": {
      "type": "string",
      "description": "The address of the company"
    },
    "companyCity": {
      "type": "string",
      "description": "The city of the company"
    },
    "companyState": {
      "type": "string",
      "description": "The state the company is in (US based)"
    },
    "companyCountry": {
      "$ref": "#/$defs/CountryCode"
    },
    "contactEmail": {
      "$ref": "#/$defs/ContactEmail",
      "description": "The email for the company's primary contact"
    },
    "contactFullName": {
      "type": "string",
      "description": "The name of the company's primary contact"
    },
    "contactPhoneNumber": {
      "type": "string",
      "description": "The phone number of the company's primary contact"
    },
    "companyTaxId": {
      "type": "string",
      "description": "The tax identification or registration number of the company"
    },
    "externalCustomerId": {
      "type": "string",
      "description": "The id used to identify the customer within your platform"
    },
    "status": {
      "$ref": "#/$defs/CustomerStatus"
    },
    "extraFields": {
      "$ref": "#/$defs/CustomersExtraFieldsParam",
      "description": "Additional fields that provide further details about the customer.\nThese fields should be specified as a valid JSON object."
    }
  },
  "required": [
    "id",
    "companyName",
    "companyCountry",
    "externalCustomerId",
    "status"
  ],
  "type": "object",
  "additionalProperties": false,
  "$defs": {
    "ContactEmail": {
      "type": "string",
      "description": "The email address of the company's primary contact"
    },
    "CountryCode": {
      "type": "string",
      "description": "The alpha-2 ISO 3166 country code of the entity's country.",
      "pattern": "^[A-Za-z]{2}$"
    },
    "CustomerStatus": {
      "description": "The eligibility of the customer to receive quotes",
      "enum": [
        "Pending",
        "Approved",
        "Rejected"
      ],
      "type": "string"
    },
    "CustomersExtraFieldsParam": {
      "properties": {},
      "additionalProperties": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number",
            "format": "double"
          },
          {
            "type": "boolean"
          }
        ]
      },
      "type": "object",
      "description": "Additional fields that provide further details about the company.\nThese fields should be specified as a valid JSON object."
    },
    "UUID": {
      "type": "string",
      "format": "uuid",
      "pattern": "[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}"
    }
  }
}