using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Valg.EVA.Skanning.ServicesModel.ServiceContracts.Count.Read;

namespace Valg.Eva.Skanning.Scan.Presentation.MainWindow
{
    public class CountingUnitCollection : IEnumerable<ScannableCounting>
    {
        private readonly List<ScannableCounting> countings;
        public bool HasMoreThanOnescannableCounting { get { return countings.Count() > 1; } }
        public string FirstCountingEmlAreaContextId
        {
            get
            {
                return countings.Count > 0
                    ? countings.First().CountingEmlAreaContextId
                    : string.Empty;
            }
        }

        public ScannableCounting FirstCounting { get { return countings[0]; } }
        public ScannableCounting SecondCounting { get { return countings[1]; } }
        public CountingUnitCollection(IEnumerable<ScannableCounting> countings)
        {
            this.countings = countings.ToList();
        }

        public IEnumerator<ScannableCounting> GetEnumerator()
        {
            return countings.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
    }
}
