using IntegrationKSSS.WebService.Infrastructure.Repositories;
using Microsoft.AspNetCore.Authorization;

namespace IntegrationKSSS.WebService.Infrastructure.RequestHandlers
{
    internal static class KsssFunctions
    {
        internal static Func<IKsssRepository, Dictionary<string, string>, Task<IResult>> WriteKsssData()
        {
            return /*[Authorize] */async (IKsssRepository ksssRepository, Dictionary<string,string> ksss) =>
            {
                
                var message = await ksssRepository.WriteKsssData(ksss)/*.ConfigureAwait(false)*/;
                if(message.Contains("Successfully"))
                {
                    return Results.Ok(message);

                }
                else
                {
                    return Results.BadRequest(message);

                }
            };
        }
    }
} 
