{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dbt-se/json-schema/dbt-se-profile-response-body-schema.json",
  "title": "ProfileResponseBody",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dbt-se-identity-api-openapi.yml#/components/schemas/ProfileResponseBody",
  "type": "object",
  "properties": {
    "email": {
      "type": [
        "string",
        "null"
      ],
      "format": "email"
    },
    "phoneNumber": {
      "type": [
        "string",
        "null"
      ]
    },
    "displayName": {
      "type": "string"
    },
    "fullName": {
      "type": [
        "string",
        "null"
      ]
    },
    "givenName": {
      "type": [
        "string",
        "null"
      ]
    },
    "familyName": {
      "type": [
        "string",
        "null"
      ]
    },
    "person": {
      "anyOf": [
        {
          "$ref": "#/$defs/IdentifiedPersonResponseBody"
        },
        {
          "type": "null"
        }
      ]
    },
    "profilePictureUrl": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri"
    },
    "primaryAssociation": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "unknown"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "staff"
              ]
            },
            "id": {
              "type": "string"
            },
            "organizationalUnitPath": {
              "type": "string"
            },
            "permissions": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/StaffPermission"
              }
            }
          },
          "required": [
            "type",
            "id",
            "organizationalUnitPath",
            "permissions"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "contact"
              ]
            },
            "contacts": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/CaseContactResponseBody"
              }
            }
          },
          "required": [
            "type",
            "contacts"
          ]
        }
      ]
    }
  },
  "required": [
    "email",
    "phoneNumber",
    "displayName",
    "fullName",
    "givenName",
    "familyName",
    "person",
    "profilePictureUrl",
    "primaryAssociation"
  ],
  "$defs": {
    "ActiveCaseContact": {
      "type": "object",
      "properties": {
        "revokedAt": {
          "type": "null"
        },
        "isSignee": {
          "type": "boolean"
        },
        "isOfficialContact": {
          "type": "boolean"
        }
      },
      "required": [
        "revokedAt",
        "isSignee",
        "isOfficialContact"
      ]
    },
    "CaseContactResponseBody": {
      "allOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "caseId": {
              "type": "integer"
            },
            "name": {
              "type": "string"
            },
            "email": {
              "type": [
                "string",
                "null"
              ],
              "format": "email"
            },
            "phoneNumber": {
              "type": [
                "string",
                "null"
              ]
            },
            "roles": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "representative",
                  "ceo",
                  "cfo",
                  "board-chair",
                  "board-member",
                  "deputy-board-member",
                  "authorized-signatory",
                  "shareholder",
                  "beneficial-owner",
                  "contact-person",
                  "proxy",
                  "auditor",
                  "accounting-consultant",
                  "legal-counsel",
                  "bookkeeping-data-contact",
                  "invoice-contact",
                  "other"
                ]
              }
            }
          },
          "required": [
            "id",
            "caseId",
            "name",
            "email",
            "phoneNumber",
            "roles"
          ]
        },
        {
          "anyOf": [
            {
              "$ref": "#/$defs/CaseContactWithNationalId"
            },
            {
              "$ref": "#/$defs/CaseContactWithoutNationalId"
            }
          ]
        },
        {
          "anyOf": [
            {
              "$ref": "#/$defs/ActiveCaseContact"
            },
            {
              "$ref": "#/$defs/RevokedCaseContact"
            }
          ]
        }
      ]
    },
    "CaseContactWithNationalId": {
      "type": "object",
      "properties": {
        "physicalPersonId": {
          "type": "string",
          "format": "uuid"
        },
        "maskedNationalIdentificationNumber": {
          "type": "string"
        },
        "nationalIdentificationNumber": {
          "type": "string"
        },
        "isIdentityVerified": {
          "type": "boolean"
        }
      },
      "required": [
        "physicalPersonId",
        "maskedNationalIdentificationNumber",
        "nationalIdentificationNumber",
        "isIdentityVerified"
      ]
    },
    "CaseContactWithoutNationalId": {
      "type": "object",
      "properties": {
        "nationalIdentificationNumber": {
          "type": "null"
        },
        "isIdentityVerified": {
          "type": "boolean",
          "enum": [
            false
          ]
        }
      },
      "required": [
        "nationalIdentificationNumber",
        "isIdentityVerified"
      ]
    },
    "IdentifiedPersonResponseBody": {
      "type": "object",
      "properties": {
        "physicalPersonId": {
          "type": "string",
          "format": "uuid"
        },
        "maskedNationalIdentificationNumber": {
          "type": "string"
        },
        "nationalIdentificationNumber": {
          "type": "string"
        }
      },
      "required": [
        "physicalPersonId",
        "maskedNationalIdentificationNumber",
        "nationalIdentificationNumber"
      ]
    },
    "RevokedCaseContact": {
      "type": "object",
      "properties": {
        "revokedAt": {
          "type": "string",
          "format": "date-time"
        },
        "isSignee": {
          "type": "boolean",
          "enum": [
            false
          ]
        },
        "isOfficialContact": {
          "type": "boolean",
          "enum": [
            false
          ]
        }
      },
      "required": [
        "revokedAt",
        "isSignee",
        "isOfficialContact"
      ]
    },
    "StaffPermission": {
      "type": "string",
      "enum": [
        "case_review_write",
        "case_review_assess",
        "developer_tools_users"
      ]
    }
  }
}