namespace CloudGaming.Code.MiddlewareExtend;

/// <summary>
/// 
/// </summary>
public static class MiddlewareExtends
{
    /// <summary>
    /// 加载全部中间件
    /// </summary>
    /// <param name="builder"></param>
    /// <returns></returns>
    public static IApplicationBuilder UseCloudGamingMiddlewareAll(this IApplicationBuilder builder)
    {
        return builder
            .UseSignMiddleware()
            .UseCacheMiddleware()
            .UseRedisCacheMiddleware()
            ;

    }

    /// <summary>
    /// 缓存中间件
    /// </summary>
    /// <param name="builder"></param>
    /// <returns></returns>
    public static IApplicationBuilder UseCacheMiddleware(this IApplicationBuilder builder)
    {
        return builder.UseMiddleware<MemoryCacheMiddleware>();
    }
    public static IApplicationBuilder UseRedisCacheMiddleware(this IApplicationBuilder builder)
    {
        return builder.UseMiddleware<RedisCacheMiddleware>();
    }

    /// <summary>
    /// 加密验证
    /// </summary>
    /// <param name="builder"></param>
    /// <returns></returns>
    public static IApplicationBuilder UseSignMiddleware(this IApplicationBuilder builder)
    {
        return builder.UseMiddleware<SignMiddleware>();
    }
}
