{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/CreateCustomCredentialDTO",
  "title": "CreateCustomCredentialDTO",
  "type": "object",
  "properties": {
    "provider": {
      "type": "string",
      "enum": [
        "custom-credential"
      ]
    },
    "authenticationPlan": {
      "description": "This is the authentication plan. Supports OAuth2 RFC 6749, HMAC signing, and Bearer authentication.",
      "oneOf": [
        {
          "$ref": "#/components/schemas/OAuth2AuthenticationPlan"
        },
        {
          "$ref": "#/components/schemas/HMACAuthenticationPlan"
        },
        {
          "$ref": "#/components/schemas/BearerAuthenticationPlan"
        }
      ],
      "discriminator": {
        "propertyName": "type",
        "mapping": {
          "oauth2": "#/components/schemas/OAuth2AuthenticationPlan",
          "hmac": "#/components/schemas/HMACAuthenticationPlan",
          "bearer": "#/components/schemas/BearerAuthenticationPlan"
        }
      }
    },
    "encryptionPlan": {
      "description": "This is the encryption plan for encrypting sensitive data. Currently supports public-key encryption.",
      "oneOf": [
        {
          "$ref": "#/components/schemas/PublicKeyEncryptionPlan"
        }
      ],
      "discriminator": {
        "propertyName": "type",
        "mapping": {
          "public-key": "#/components/schemas/PublicKeyEncryptionPlan"
        }
      },
      "allOf": [
        {
          "$ref": "#/components/schemas/PublicKeyEncryptionPlan"
        }
      ]
    },
    "name": {
      "type": "string",
      "description": "This is the name of credential. This is just for your reference.",
      "minLength": 1,
      "maxLength": 40
    }
  },
  "required": [
    "provider",
    "authenticationPlan"
  ]
}