public async Task <ClaimResult> EditPickupBid(PickupBid bid, PublisherGame?conditionalDropPublisherGame, uint bidAmount)
    {
        if (bid.Successful != null)
        {
            return(new ClaimResult(new List <ClaimError>()
            {
                new ClaimError("Bid has already been processed", false)
            }, null));
        }

        if (bidAmount < bid.LeagueYear.Options.MinimumBidAmount)
        {
            return(new ClaimResult(new List <ClaimError>()
            {
                new ClaimError("That bid does not meet the league's minimum bid.", false)
            }, null));
        }

        if (bidAmount > bid.Publisher.Budget)
        {
            return(new ClaimResult(new List <ClaimError>()
            {
                new ClaimError("You do not have enough budget to make that bid.", false)
            }, null));
        }

        int?validDropSlot = null;

        if (conditionalDropPublisherGame is not null)
        {
            if (bid.CounterPick)
            {
                return(new ClaimResult("Cannot make a counter pick bid with a conditional drop.", null));
            }

            var dropResult = await MakeDropRequest(bid.LeagueYear, bid.Publisher, conditionalDropPublisherGame, true);

            if (dropResult.Result.IsFailure)
            {
                return(new ClaimResult(dropResult.Result.Error, null));
            }

            validDropSlot = conditionalDropPublisherGame.SlotNumber;
        }

        await _fantasyCriticRepo.EditPickupBid(bid, conditionalDropPublisherGame, bidAmount);

        var currentDate = _clock.GetToday();
        MasterGameWithEligibilityFactors eligibilityFactors = bid.LeagueYear.GetEligibilityFactorsForMasterGame(bid.MasterGame, currentDate);
        var slotResult = SlotEligibilityService.GetPublisherSlotAcquisitionResult(bid.Publisher, bid.LeagueYear.Options, eligibilityFactors, bid.CounterPick, validDropSlot, false);

        if (!slotResult.SlotNumber.HasValue)
        {
            return(new ClaimResult(slotResult.ClaimErrors, null));
        }

        return(new ClaimResult(slotResult.SlotNumber.Value));
    }
    public ClaimResult CanClaimGame(ClaimGameDomainRequest request, Instant?nextBidTime, int?validDropSlot, bool acquiringNow, bool drafting)
    {
        var currentDate = _clock.GetToday();
        var dateOfPotentialAcquisition = currentDate;

        if (nextBidTime.HasValue)
        {
            dateOfPotentialAcquisition = nextBidTime.Value.ToEasternDate();
        }

        var leagueYear = request.LeagueYear;

        List <ClaimError> claimErrors = new List <ClaimError>();

        var basicErrors = GetBasicErrors(leagueYear.League, request.Publisher);

        claimErrors.AddRange(basicErrors);

        if (request.MasterGame is not null)
        {
            var masterGameErrors = GetGenericSlotMasterGameErrors(leagueYear, request.MasterGame, leagueYear.Year, false, currentDate,
                                                                  dateOfPotentialAcquisition, request.CounterPick, request.CounterPickedGameIsManualWillNotRelease, drafting);
            claimErrors.AddRange(masterGameErrors);
        }

        LeaguePublisherGameSet gameSet = new LeaguePublisherGameSet(request.Publisher.PublisherID, leagueYear.Publishers);
        bool thisPlayerAlreadyHas      = gameSet.ThisPlayerStandardGames.ContainsGame(request);
        bool gameAlreadyClaimed        = gameSet.OtherPlayerStandardGames.ContainsGame(request);

        if (!request.CounterPick)
        {
            if (gameAlreadyClaimed)
            {
                claimErrors.Add(new ClaimError("Cannot claim a game that someone already has.", false));
            }

            if (thisPlayerAlreadyHas)
            {
                claimErrors.Add(new ClaimError("Cannot claim a game that you already have.", false));
            }
        }

        if (request.CounterPick)
        {
            bool otherPlayerHasCounterPick = gameSet.OtherPlayerCounterPicks.ContainsGame(request);
            if (otherPlayerHasCounterPick)
            {
                claimErrors.Add(new ClaimError("Cannot counter-pick a game that someone else has already counter picked.", false));
            }
            bool thisPlayerHasCounterPick = gameSet.ThisPlayerCounterPicks.ContainsGame(request);
            if (thisPlayerHasCounterPick)
            {
                claimErrors.Add(new ClaimError("You already have that counter pick.", false));
            }

            bool otherPlayerHasDraftGame = gameSet.OtherPlayerStandardGames.ContainsGame(request);
            if (!otherPlayerHasDraftGame)
            {
                claimErrors.Add(new ClaimError("Cannot counter pick a game that no other player is publishing.", false));
            }
        }

        MasterGameWithEligibilityFactors?eligibilityFactors = null;

        if (request.MasterGame is not null)
        {
            eligibilityFactors = leagueYear.GetEligibilityFactorsForMasterGame(request.MasterGame, dateOfPotentialAcquisition);
        }

        var slotResult = SlotEligibilityService.GetPublisherSlotAcquisitionResult(request.Publisher, leagueYear.Options, eligibilityFactors, request.CounterPick, validDropSlot, acquiringNow);

        if (!slotResult.SlotNumber.HasValue)
        {
            claimErrors.AddRange(slotResult.ClaimErrors);
            return(new ClaimResult(claimErrors, null));
        }

        var result = new ClaimResult(claimErrors, slotResult.SlotNumber.Value);

        if (result.Overridable && request.ManagerOverride)
        {
            return(new ClaimResult(slotResult.SlotNumber.Value));
        }

        return(result);
    }