local typedefs = require "kong.db.schema.typedefs"

return {
  name = "auth0-validator",
  fields = {
    { consumer = typedefs.no_consumer },
    { protocols = typedefs.protocols_http },
    { config = {
        type = "record",
        fields = {
          {
            issuer = {
              type = "string",
              required = true,
              description = "The Auth0 issuer URL (e.g. https://tidb-soc2.us.auth0.com/)",
            }
          },
          {
            audience = {
              type = "string",
              required = true,
              description = "The expected audience claim value.",
            }
          },
          {
            token_header = typedefs.header_name {
              default = "Authorization",
              description = "The header containing the Bearer token.",
            }
          },
          {
            jwks_custom_url = {
              type = "string",
              required = false,
              description = "Override the default JWKS URL (default is issuer + .well-known/jwks.json).",
            }
          }
        }
      }
    }
  },
}
