{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/viridi-parente/main/json-schema/viridi-parente-account-two-fa-settings-schema.json",
  "title": "AccountTwoFaSettings",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/viridi-parente-two-factor-auth-config-controller-api-openapi.yml#/components/schemas/AccountTwoFaSettings",
  "properties": {
    "configs": {
      "type": "object",
      "additionalProperties": {
        "oneOf": [
          {
            "$ref": "#/$defs/BackupCodeTwoFaAccountConfig"
          },
          {
            "$ref": "#/$defs/EmailTwoFaAccountConfig"
          },
          {
            "$ref": "#/$defs/SmsTwoFaAccountConfig"
          },
          {
            "$ref": "#/$defs/TotpTwoFaAccountConfig"
          }
        ]
      }
    }
  },
  "$defs": {
    "BackupCodeTwoFaAccountConfig": {
      "allOf": [
        {
          "$ref": "#/$defs/TwoFaAccountConfig"
        },
        {
          "type": "object",
          "properties": {
            "codes": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "uniqueItems": true
            },
            "codesLeft": {
              "type": "integer",
              "format": "int32"
            }
          }
        }
      ],
      "required": [
        "codes"
      ]
    },
    "EmailTwoFaAccountConfig": {
      "allOf": [
        {
          "$ref": "#/$defs/TwoFaAccountConfig"
        },
        {
          "type": "object",
          "properties": {
            "email": {
              "type": "string"
            }
          }
        }
      ],
      "required": [
        "email"
      ]
    },
    "SmsTwoFaAccountConfig": {
      "allOf": [
        {
          "$ref": "#/$defs/TwoFaAccountConfig"
        },
        {
          "type": "object",
          "properties": {
            "phoneNumber": {
              "type": "string",
              "pattern": "^\\+[1-9]\\d{1,14}$"
            }
          }
        }
      ],
      "required": [
        "phoneNumber"
      ]
    },
    "TotpTwoFaAccountConfig": {
      "allOf": [
        {
          "$ref": "#/$defs/TwoFaAccountConfig"
        },
        {
          "type": "object",
          "properties": {
            "authUrl": {
              "type": "string",
              "pattern": "otpauth://totp/(\\S+?):(\\S+?)\\?issuer=(\\S+?)&secret=(\\w+?)"
            }
          }
        }
      ],
      "required": [
        "authUrl"
      ]
    },
    "TwoFaAccountConfig": {
      "properties": {
        "useByDefault": {
          "type": "boolean"
        },
        "providerType": {
          "type": "string"
        }
      },
      "required": [
        "providerType"
      ]
    }
  }
}