import {OS3Flows} from "./OS3Flows.js";

export interface OS3SecurityBase {
  /**
   * The type of the security scheme
   */
  type: "apiKey" | "oauth2" | "http" | "openIdConnect";
  /**
   *
   */
  description?: string;
}

export interface OS3SecurityApiKey extends OS3SecurityBase {
  /**
   * The type of the security scheme
   */
  type: "apiKey";
  /**
   * The name of the header, query or cookie parameter to be used.
   */
  name: string;
  /**
   * The location of the API key. Valid values are `query`, `header` or `cookie`.
   */
  in: "query" | "header" | "cookie";
}

export interface OS3SecurityOAuth2 extends OS3SecurityBase {
  /**
   * The type of the security scheme
   */
  type: "oauth2";
  /**
   * An object containing configuration information for the flow types supported.
   */
  flows: OS3Flows;
}

export interface OS3SecurityOpenIDConnect extends OS3SecurityBase {
  /**
   * The type of the security scheme
   */
  type: "openIdConnect";
  openIdConnectUrl: string;
}

export interface OS3SecurityHTTP extends OS3SecurityBase {
  /**
   * The type of the security scheme
   */
  type: "http";
  /**
   * The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-5.1).
   */
  scheme: string;
  /**
   * A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes.
   */
  bearerFormat?: string;
}

export type OS3Security = OS3SecurityApiKey | OS3SecurityHTTP | OS3SecurityOAuth2 | OS3SecurityOpenIDConnect;
