{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/v2.7.0-rc3/schemas/definitions/user.json",
    "definitions": {
        "id": {
            "$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/v2.7.0-rc3/schemas/definitions/common.json#/definitions/id",
            "title": "User ID"
        },
        "username": {
            "type": "string",
            "title": "Username",
            "example": "iqrf"
        },
        "email": {
            "type": [
                "string",
                "null"
            ],
            "format": "email",
            "title": "Email",
            "example": "iqrf@example.org"
        },
        "language": {
            "type": "string",
            "title": "User language",
            "enum": [
                "cs",
                "en"
            ],
            "default": "en",
            "example": "en"
        },
        "password": {
            "type": "string",
            "title": "Password",
            "minLength": 15,
            "maxLength": 64,
            "pattern": "^[ -~]+$",
            "example": "8Yz#t>pL^sD|Uq&bW@"
        },
        "passwordOld": {
            "type": "string",
            "title": "Password",
            "minLength": 1,
            "example": "8Yz#t>pL^sD|Uq&bW@"
        },
        "role": {
            "type": "string",
            "title": "User role",
            "enum": [
                "admin",
                "normal",
                "basic"
            ],
            "default": "normal",
            "example": "normal"
        },
        "state": {
            "type": "string",
            "title": "Account state",
            "enum": [
                "unverified",
                "verified",
                "blocked",
                "invited"
            ],
            "example": "verified"
        },
        "has2Fa": {
            "type": "boolean",
            "title": "Has 2FA enabled",
            "example": false
        },
        "totpCode": {
            "title": "TOTP code",
            "type": "string",
            "pattern": "^[0-9]{6}$",
            "example": "123456"
        },
        "brief": {
            "type": "object",
            "title": "User brief info",
            "additionalProperties": false,
            "required": [
                "id",
                "username",
                "email"
            ],
            "properties": {
                "id": {
                    "$ref": "#/definitions/id"
                },
                "username": {
                    "$ref": "#/definitions/username"
                },
                "email": {
                    "$ref": "#/definitions/email"
                }
            }
        }
    }
}
