{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/if/json-schema/if-user-create-response-schema.json",
  "title": "UserCreateResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/if-users-api-openapi.yml#/components/schemas/UserCreateResponse",
  "required": [
    "connect",
    "data",
    "metadata",
    "workflow"
  ],
  "type": "object",
  "properties": {
    "workflow": {
      "$ref": "#/$defs/UserCreateWorkflowContainer"
    },
    "data": {
      "$ref": "#/$defs/UserCreateDataContainer"
    },
    "connect": {
      "$ref": "#/$defs/UserCreateConnectContainer"
    },
    "metadata": {
      "$ref": "#/$defs/UserCreateMetadataContainer"
    }
  },
  "$defs": {
    "Address": {
      "required": [
        "city",
        "country",
        "street"
      ],
      "type": "object",
      "properties": {
        "country": {
          "maxLength": 2,
          "minLength": 2,
          "pattern": "^[A-Z]{2}$",
          "type": "string"
        },
        "region": {
          "type": "string"
        },
        "postalCode": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "street": {
          "type": "string"
        },
        "houseNumber": {
          "type": "string"
        },
        "refinement": {
          "type": "string"
        }
      }
    },
    "BankingUserProfile": {
      "type": "object",
      "properties": {
        "phone": {
          "type": "string"
        },
        "residentialAddress": {
          "$ref": "#/$defs/Address"
        }
      }
    },
    "BankingUserStatus": {
      "type": "string",
      "readOnly": true,
      "enum": [
        "active",
        "inactive"
      ]
    },
    "LegalEntityIdentification": {
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/$defs/LegalEntityIdentificationType"
        },
        "identificationNumber": {
          "type": "string"
        },
        "issuingCountry": {
          "maxLength": 2,
          "minLength": 2,
          "pattern": "^[A-Z]{2}$",
          "type": "string"
        },
        "issueDate": {
          "type": "string",
          "format": "date"
        },
        "expirationDate": {
          "type": "string",
          "format": "date"
        }
      }
    },
    "LegalEntityIdentificationType": {
      "type": "string",
      "enum": [
        "registration-number",
        "passport",
        "identity-card",
        "driving-licence",
        "foreign-identity-card",
        "tax-number"
      ]
    },
    "LegalEntityIdentityIndividual": {
      "required": [
        "familyName",
        "givenName"
      ],
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/$defs/LegalEntityType"
        },
        "country": {
          "maxLength": 2,
          "minLength": 2,
          "pattern": "^[A-Z]{2}$",
          "type": "string"
        },
        "identifications": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LegalEntityIdentification"
          }
        },
        "givenName": {
          "type": "string"
        },
        "familyName": {
          "type": "string"
        },
        "birthDate": {
          "type": "string",
          "format": "date"
        }
      }
    },
    "LegalEntityType": {
      "type": "string",
      "enum": [
        "corporate",
        "individual"
      ]
    },
    "User": {
      "required": [
        "category",
        "email",
        "identity",
        "type"
      ],
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "readOnly": true
        },
        "email": {
          "type": "string"
        },
        "givenName": {
          "type": "string"
        },
        "familyName": {
          "type": "string"
        },
        "identity": {
          "$ref": "#/$defs/LegalEntityIdentityIndividual"
        },
        "category": {
          "type": "string",
          "readOnly": true,
          "enum": [
            "external"
          ]
        },
        "type": {
          "type": "string",
          "readOnly": true,
          "enum": [
            "human"
          ]
        },
        "profile": {
          "$ref": "#/$defs/BankingUserProfile"
        },
        "status": {
          "$ref": "#/$defs/BankingUserStatus"
        }
      },
      "readOnly": true
    },
    "UserClientRelation": {
      "required": [
        "clientId"
      ],
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "readOnly": true
        },
        "userId": {
          "type": "string",
          "format": "uuid",
          "readOnly": true
        },
        "clientId": {
          "type": "string",
          "format": "uuid"
        },
        "status": {
          "$ref": "#/$defs/UserClientStatus"
        }
      }
    },
    "UserClientRelationType": {
      "type": "string",
      "description": "user's relation with client",
      "enum": [
        "director",
        "shareholder",
        "director-and-shareholder",
        "authorized-person"
      ]
    },
    "UserClientStatus": {
      "type": "string",
      "readOnly": true,
      "enum": [
        "allowed",
        "revoked"
      ]
    },
    "UserCreateConnectContainer": {
      "type": "object"
    },
    "UserCreateDataContainer": {
      "required": [
        "user"
      ],
      "type": "object",
      "properties": {
        "user": {
          "$ref": "#/$defs/User"
        },
        "invitations": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/UserInvitation"
          }
        },
        "userClientRelations": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/UserClientRelation"
          }
        }
      }
    },
    "UserCreateMetadataContainer": {
      "type": "object"
    },
    "UserCreateWorkflow": {
      "type": "string",
      "description": "unique workflow code",
      "enum": [
        "human.external.invitation",
        "human.external.direct"
      ]
    },
    "UserCreateWorkflowContainer": {
      "required": [
        "code"
      ],
      "type": "object",
      "properties": {
        "code": {
          "$ref": "#/$defs/UserCreateWorkflow"
        }
      }
    },
    "UserInvitation": {
      "required": [
        "clientId",
        "id",
        "status",
        "userClientRelation"
      ],
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "readOnly": true
        },
        "clientId": {
          "type": "string",
          "format": "uuid"
        },
        "userClientRelation": {
          "$ref": "#/$defs/UserClientRelationType"
        },
        "status": {
          "$ref": "#/$defs/UserInvitationStatus"
        }
      }
    },
    "UserInvitationStatus": {
      "type": "string",
      "description": "status of invitation",
      "readOnly": true,
      "enum": [
        "accepted",
        "pending",
        "rejected",
        "cancelled"
      ]
    }
  }
}