using FastEndpoints;
using FluentValidation;

namespace KArtSell.Modules.SignalEngine.Features.EvaluateResearchSellPolicy;

public sealed class Validator : Validator<Request>
{
    public Validator()
    {
        RuleFor(x => x.PositionLotId).NotEmpty();
        RuleFor(x => x.CycleId).NotEmpty();
        RuleFor(x => x.EvidenceId).NotEmpty().MaximumLength(128);
        RuleFor(x => x.DatasetId).NotEmpty().MaximumLength(128);
        RuleFor(x => x.ModelVersion).NotEmpty().MaximumLength(128);
        RuleFor(x => x.ConfigVersion).NotEmpty().MaximumLength(128);
        RuleFor(x => x.CodeSha).NotEmpty().MaximumLength(128);
        RuleFor(x => x.PublishedAtCutoff).LessThanOrEqualTo(x => x.AsOf);
        RuleFor(x => x.CurrentSecurityPortfolioWeight).InclusiveBetween(0m, 1m);
        RuleFor(x => x.CurrentLotPortfolioWeight).InclusiveBetween(0m, 1m)
            .LessThanOrEqualTo(x => x.CurrentSecurityPortfolioWeight);
        RuleFor(x => x.StrategicCoreFloorWeight).InclusiveBetween(0m, 1m);
        RuleFor(x => x.SurvivalSellRatioOfLot).InclusiveBetween(0m, 1m);
        RuleFor(x => x.GapBelowFloorAtr).GreaterThanOrEqualTo(0m);
        RuleFor(x => x.ConsecutiveCloseBreaches).GreaterThanOrEqualTo(0);
        RuleFor(x => x.ConcentrationSellRatioOfLot).InclusiveBetween(0m, 1m);
        RuleFor(x => x.OpportunitySellRatioOfLot).InclusiveBetween(0m, 1m);
    }
}
