using VentaUniformesapi;
using VentaUniformesApplication.Interfaces;
using VentaUniformesCommon;
using VentaUniformesPersistencia;
using VentaUniformesExternal;
using VentaUniformesApplication.Persistencia.user.commands.CreateUser;
using VentaUniformesApplication;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.


//añadir dependencias por inyeccion---------------------------
//añadri cadena de conexion esto te obliga a añadir dependencias a entity
//builder.Services.addDbContext


//inyeccion de dependencias te obliga a linckar persistencia y a externo¿?

//builder.Services.AddScoped<IPersistenciaService, PersistenciaService>();

builder.Services.AddControllers();

builder.Services.AddWebApi()
    .AddCommon()
    .AddAplication()
  .AddExternal(builder.Configuration)
  .AddPersistencia(builder.Configuration);

//


var app = builder.Build();
//poner swagger
app.UseSwagger();
app.UseSwaggerUI( options =>
{
    options.SwaggerEndpoint("/swagger/v1/swagger.json", "v1");
    options.RoutePrefix = string.Empty;
});
app.UseAuthentication();
app.UseAuthorization();


app.MapControllers();



//prueba de servicios-------------------------------------------
/*
app.MapGet("/test", async (IcreateUserCommand service) =>
{
    var e = new CreateUserModel();
    e.UserName = "test";
    e.FristName = "FristName";
    e.LastName = "LastName";
    e.Password = "Password";

    return await service.Execute(e);
});
*/
//--------------------------------------------------------------

// Configure the HTTP request pipeline.

app.Run();
