namespace DocuMed.Api.Controllers;

public class UserController : ICarterModule
{
    public void AddRoutes(IEndpointRouteBuilder app)
    {

        var group = app.NewVersionedApi("User")
            .MapGroup($"api/user")
            .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());


        group.MapPut("", EditUserAsync)
            .WithDisplayName("EditUser")
            .HasApiVersion(1.0);
    }

    public virtual async Task<IResult> EditUserAsync([FromBody]UserActionRequestDto request,IUserService userService,CancellationToken cancellationToken)
    {
        await userService.EditUserAsync(request, cancellationToken);
        return TypedResults.Ok();
    }
}