using System;
using Valg.EVA.Skanning.Entity.ReadModel;

namespace Valg.EVA.Skanning.ServicesModel.Internal.CountResult
{
    public static class Guard
    {
        public static void AssertAreaContextFormat(string areaContext)
        {
            
            if (areaContext.Length != 22 && areaContext.Length != 17)
            {
                throw new ArgumentException("Unknown format");
            }
        }

        public static void AssertBallotNoFieldPresent(int ballotPaperId, BallotPaperFieldValue ballotNoField)
        {
            if (ballotNoField == null || String.IsNullOrWhiteSpace(ballotNoField.Value))
                throw new InvalidOperationException(String.Format("A valid ballot must contain a ballotNo field at this stage. BallotPaperId = {0}", ballotPaperId));
        }
    }
}
