{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/phoenix/json-schema/phoenix-create-user-request-body-schema.json",
  "title": "CreateUserRequestBody",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/phoenix-users-api-openapi.yml#/components/schemas/CreateUserRequestBody",
  "properties": {
    "user": {
      "oneOf": [
        {
          "$ref": "#/$defs/LocalUserData"
        },
        {
          "$ref": "#/$defs/OAuth2UserData"
        },
        {
          "$ref": "#/$defs/LDAPUserData"
        }
      ],
      "title": "User"
    },
    "send_welcome_email": {
      "type": "boolean",
      "title": "Send Welcome Email",
      "default": true
    }
  },
  "type": "object",
  "required": [
    "user"
  ],
  "$defs": {
    "LDAPUserData": {
      "properties": {
        "email": {
          "type": "string",
          "title": "Email"
        },
        "username": {
          "type": "string",
          "title": "Username"
        },
        "role": {
          "type": "string",
          "enum": [
            "SYSTEM",
            "ADMIN",
            "MEMBER",
            "VIEWER"
          ],
          "title": "Role"
        },
        "auth_method": {
          "type": "string",
          "const": "LDAP",
          "title": "Auth Method"
        }
      },
      "type": "object",
      "required": [
        "email",
        "username",
        "role",
        "auth_method"
      ],
      "title": "LDAPUserData"
    },
    "LocalUserData": {
      "properties": {
        "email": {
          "type": "string",
          "title": "Email"
        },
        "username": {
          "type": "string",
          "title": "Username"
        },
        "role": {
          "type": "string",
          "enum": [
            "SYSTEM",
            "ADMIN",
            "MEMBER",
            "VIEWER"
          ],
          "title": "Role"
        },
        "auth_method": {
          "type": "string",
          "const": "LOCAL",
          "title": "Auth Method"
        },
        "password": {
          "type": "string",
          "title": "Password"
        }
      },
      "type": "object",
      "required": [
        "email",
        "username",
        "role",
        "auth_method"
      ],
      "title": "LocalUserData"
    },
    "OAuth2UserData": {
      "properties": {
        "email": {
          "type": "string",
          "title": "Email"
        },
        "username": {
          "type": "string",
          "title": "Username"
        },
        "role": {
          "type": "string",
          "enum": [
            "SYSTEM",
            "ADMIN",
            "MEMBER",
            "VIEWER"
          ],
          "title": "Role"
        },
        "auth_method": {
          "type": "string",
          "const": "OAUTH2",
          "title": "Auth Method"
        },
        "oauth2_client_id": {
          "type": "string",
          "title": "Oauth2 Client Id"
        },
        "oauth2_user_id": {
          "type": "string",
          "title": "Oauth2 User Id"
        }
      },
      "type": "object",
      "required": [
        "email",
        "username",
        "role",
        "auth_method"
      ],
      "title": "OAuth2UserData"
    }
  }
}