using System.Collections.Generic;
using System.Linq;
using Valg.EVA.Skanning.Contracts;
using Valg.EVA.Skanning.Entity.ReadModel;
using Valg.EVA.Skanning.ServicesModel.Internal.Interpreter.Modifications;

namespace Valg.EVA.Skanning.ServicesModel.Internal.Interpreter
{
    public class BallotIdInterpreter
    {
        public void EnsureBallotIdIsNotValidated(IEnumerable<BallotPaperFieldValue> fieldValues, InterpreterModificationBuffer modificationBuffer)
        {
            var field = fieldValues.SingleOrDefault(fv => fv.IsBallotIdField());
            if (field == null)
                return;
            field.NeedsVerification = false;
            modificationBuffer.AddModifiedField(field);
        }
    }
}

