{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/kibo-commerce/main/json-schema/kibo-commerce-b2-buser-schema.json",
  "title": "B2BUser",
  "description": "Customer account. Customers provide contact information, view order history, and set email preferences on their account. \nMerchants can edit accounts to add internal notes or assign them to segments.",
  "x-generated": "2026-10-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/kibo-commerce-customer-openapi.yml#/components/schemas/B2BUser",
  "properties": {
    "acceptsMarketing": {
      "description": "If true, the customer prefers to receive marketing material such as newsletters or email offers.",
      "type": "boolean"
    },
    "emailAddress": {
      "type": [
        "string",
        "null"
      ]
    },
    "firstName": {
      "type": [
        "string",
        "null"
      ]
    },
    "hasExternalPassword": {
      "description": "Indicates if an external password is set on this account",
      "type": "boolean"
    },
    "isActive": {
      "type": "boolean"
    },
    "isLocked": {
      "type": "boolean"
    },
    "isRemoved": {
      "type": "boolean"
    },
    "last2FaDate": {
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "lastName": {
      "type": [
        "string",
        "null"
      ]
    },
    "localeCode": {
      "type": [
        "string",
        "null"
      ]
    },
    "roles": {
      "items": {
        "$ref": "#/$defs/UserRole"
      },
      "type": [
        "array",
        "null"
      ]
    },
    "userId": {
      "description": "Unique identifier of the user who is currently logged in. This is null if the user is anonymous (not logged in).  Unicode data with a maximum length of 55 characters.",
      "type": [
        "string",
        "null"
      ]
    },
    "userName": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "type": "object",
  "$defs": {
    "AuditInfo": {
      "properties": {
        "createBy": {
          "type": [
            "string",
            "null"
          ]
        },
        "createDate": {
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        },
        "updateBy": {
          "type": [
            "string",
            "null"
          ]
        },
        "updateDate": {
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "Resource": {
      "properties": {
        "id": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "UserRole": {
      "properties": {
        "assignedInScope": {
          "$ref": "#/$defs/UserScope"
        },
        "auditInfo": {
          "$ref": "#/$defs/AuditInfo"
        },
        "roleId": {
          "format": "int32",
          "type": "integer"
        },
        "roleName": {
          "type": [
            "string",
            "null"
          ]
        },
        "roleResources": {
          "items": {
            "$ref": "#/$defs/Resource"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "roleTags": {
          "items": {
            "type": "string"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "userId": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "UserScope": {
      "properties": {
        "id": {
          "format": "int32",
          "type": [
            "integer",
            "null"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    }
  }
}