using Microsoft.OpenApi.Models;

namespace OBSBoardsApi.Swagger
{
    public class OpenApiSecuritySwagger
    {
        public static OpenApiSecurityScheme SecurityScheme()
        {
            return new OpenApiSecurityScheme
            {
                Description = "e.g. Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS...",
                Name = "Authorization",
                In = ParameterLocation.Header,
                Type = SecuritySchemeType.ApiKey,
                Scheme = "Bearer"
            };
        }

        public static OpenApiSecurityRequirement SecurityRequirement()
        {
            return new OpenApiSecurityRequirement
            {
                {
                    new OpenApiSecurityScheme
                    {
                        Reference = new OpenApiReference
                        {
                            Type = ReferenceType.SecurityScheme,
                            Id = "Bearer"
                        }
                    },
                    Array.Empty<string>()
                }
            };
        }
    }
}
