namespace Bit.Core.AdminConsole.Shared.Validation; public static class ValidationResultMappers { // public static Failure MapToFailure(this Error error) // { // // return error switch // { // BadRequestError badRequestError => new Failure(badRequestError.Message), // _ => throw new InvalidOperationException($"Unhandled commandResult type: {error.GetType().Name}") // } // // return commandResult switch // // { // // NoRecordFoundFailure failure => new ObjectResult(failure.ErrorMessages) { StatusCode = StatusCodes.Status404NotFound }, // // BadRequestFailure failure => new ObjectResult(failure.ErrorMessages) { StatusCode = StatusCodes.Status400BadRequest }, // // Failure failure => new ObjectResult(failure.ErrorMessages) { StatusCode = StatusCodes.Status400BadRequest }, // // Success success => new ObjectResult(success.Value) { StatusCode = StatusCodes.Status200OK }, // // _ => throw new InvalidOperationException($"Unhandled commandResult type: {commandResult.GetType().Name}") // // }; // } }