namespace Valg.EVA.Skanning.ServicesModel.ServiceContracts.Verification.Read
{
    public class RenumberStrikeoutReadOnly
    {
        public RenumberStrikeoutReadOnly(
            int candidateIndex, 
            bool neededVerification, 
            bool needsVerification,
            int? renumberAsInterpretedByScanner,
            int? renumberAsGivenByCorrection,
            bool? strikeoutAsInterpretedByScanner,
            bool? strikeoutAsGivenByCorrection,
            bool isCreatedFirstTimeByVerifier,
            bool isNoChange)
        {
            CandidateIndex = candidateIndex;
            NeededVerification = neededVerification;
            NeedsVerification = needsVerification;
            RenumberAsInterpretedByScanner = renumberAsInterpretedByScanner;
            RenumberAsGivenByCorrection = renumberAsGivenByCorrection;
            StrikeoutAsInterpretedByScanner = strikeoutAsInterpretedByScanner;
            StrikeoutAsGivenByCorrection = strikeoutAsGivenByCorrection;
            IsCreatedFirstTimeByVerifier = isCreatedFirstTimeByVerifier;
            IsNoChange = isNoChange;
        }

        public int CandidateIndex { get; private set; }
        public int? RenumberAsInterpretedByScanner { get; private set; }
        public int? RenumberAsGivenByCorrection { get; private set; }
        public bool? StrikeoutAsInterpretedByScanner { get; private set; }
        public bool? StrikeoutAsGivenByCorrection { get; private set; }
        public bool NeedsVerification { get; private set; }
        public bool NeededVerification { get; private set; }
        
        public bool HasStrikeout
        {
            get
            {
                if (!IsNoChange)
                {
                    if (StrikeoutAsGivenByCorrection.HasValue)
                        return StrikeoutAsGivenByCorrection.Value;

                    if (StrikeoutAsInterpretedByScanner.HasValue)
                        return StrikeoutAsInterpretedByScanner.Value;
                }

                return false;
            }
        }
        public int? Renumber
        {
            get
            {
                if (!IsNoChange)
                {
                    if (RenumberAsGivenByCorrection.HasValue)
                        return RenumberAsGivenByCorrection.Value;

                    if (RenumberAsInterpretedByScanner.HasValue)
                        return RenumberAsInterpretedByScanner.Value;
                }

                return null;
            }
        }
        public bool IsCreatedFirstTimeByVerifier { get; private set; }
        public bool IsNoChange { get; private set; }
    }
}
