using System;

namespace Valg.EVA.Skanning.ServicesModel.ServiceContracts.Scan.Write
{
    public class SaveScannedBallotPaperResult
    {
        private readonly int? ballotPaperId;

        public SaveScannedBallotPaperResult(bool boxCountingIsNotAcceptingScans, bool boxCountingDoesNotExist, bool hasDatabaseErrors, Exception databaseError, int? ballotPaperId)
        {
            this.ballotPaperId = ballotPaperId;
            BoxCountingIsNotAcceptingScans = boxCountingIsNotAcceptingScans;
            BoxCountingDoesNotExist = boxCountingDoesNotExist;
            HasDatabaseErrors = hasDatabaseErrors;
            DatabaseError = databaseError;
        }

        public bool BoxCountingIsNotAcceptingScans { get; private set; }
        public bool BoxCountingDoesNotExist { get; private set; }
        public bool HasDatabaseErrors { get; private set; }

        public Exception DatabaseError { get; private set; }
        public int? BallotPaperId
        {
            get { return ballotPaperId; }
        }

        public static SaveScannedBallotPaperResult DatabaseErrorsResult(bool hasDatabaseErrors, Exception databaseError)
        {
            return new SaveScannedBallotPaperResult(false, false, hasDatabaseErrors, databaseError, null);
        }
    }
}
