using System;
using System.Collections.Generic;
using System.Linq;
using Valg.EVA.Skanning.ServicesModel.ServiceContracts.CountResult.Write;

namespace Valg.EVA.Skanning.Commands.SetCountingLocked
{
    public class SetCountingLockedCommand : ICommand
    {
        private readonly int countingId;
        private readonly DateTime countingConcurrencyToken;
        private readonly string lockedBy;
        private readonly Dictionary<int, BoxCountingToLock> expectedBoxCountingsToLock;

        public SetCountingLockedCommand(int countingId, DateTime countingConcurrencyToken, IEnumerable<BoxCountingToLock> expectedBoxCountingsToLock, string lockedBy)
        {
            this.countingId = countingId;
            this.countingConcurrencyToken = countingConcurrencyToken;
            this.lockedBy = lockedBy;
            this.expectedBoxCountingsToLock = expectedBoxCountingsToLock.ToDictionary(b => b.BoxCountingId);
        }

        public int CountingId
        {
            get { return countingId; }
        }
        public DateTime CountingConcurrencyToken
        {
            get { return countingConcurrencyToken; }
        }
        public Dictionary<int, BoxCountingToLock> ExpectedBoxCountingsToLock
        {
            get { return expectedBoxCountingsToLock; }
        }
        public string LockedBy
        {
            get { return lockedBy; }
        }     
    }
}
