using CH.CQRS.Service.Energy; using CH.CQRS.Service.Energy.Options; using FluentValidation; using OpenHarbor.CQRS.Abstractions; namespace CH.CQRS.Command.Energy; public class CreateEnergyProviderCommand { public required string Name { get; set; } public bool Active { get; set; } } public class CreateEnergyProviderCommandHandler(EnergyService energyService) : ICommandHandler { public Task HandleAsync(CreateEnergyProviderCommand command, CancellationToken cancellationToken = new CancellationToken()) { return energyService.CreateEnergyProviderAsync(new CreateEnergyProviderCommandOptions { Name = command.Name, Active = command.Active },cancellationToken); } } public class CreateEnergyProviderCommandValidator : AbstractValidator { public CreateEnergyProviderCommandValidator() { } }