using System;
using Valg.EVA.Skanning.Contracts.CommonEnums;
using ReactiveUI;

namespace Valg.EVA.Skanning.JobManagement.Startup.Data.Transfer
{
    public class TransferModel : ReactiveObject, IUpdatable<TransferModel, int>
    {
        private int id;
        public int Id
        {
            get { return id; }
            set { this.RaiseAndSetIfChanged(ref id, value); }
        }
        
        private int? latestTransferId;
        public int? LatestTransferId
        {
            get { return latestTransferId; }
            set { this.RaiseAndSetIfChanged(ref latestTransferId, value); }
        }

        private int countingId;
        public int CountingId
        {
            get { return countingId; }
            set { this.RaiseAndSetIfChanged(ref countingId, value); }
        }

        private DateTime created;
        public DateTime Created
        {
            get { return created; }
            set { this.RaiseAndSetIfChanged(ref created, value); }
        }

        private DateTime? updated;
        public DateTime? Updated
        {
            get { return updated; }
            set { this.RaiseAndSetIfChanged(ref updated, value); }
        }
        
        private TransferState state;
        public TransferState State
        {
            get { return state; }
            set { this.RaiseAndSetIfChanged(ref state, value); }
        }

        private string errorCode;
        public string ErrorCode
        {
            get { return errorCode; }
            set { this.RaiseAndSetIfChanged(ref errorCode, value); }
        }

        private bool checkStatusForTransferManually;
        public bool CheckStatusForTransferManually
        {
            get { return checkStatusForTransferManually; }
            set { this.RaiseAndSetIfChanged(ref checkStatusForTransferManually, value); }
        }
        

        public void Update(TransferModel updatedModel)
        {
            Created = updatedModel.Created;
            Updated = updatedModel.Updated;
            State = updatedModel.State;
            ErrorCode = updatedModel.errorCode;
            CheckStatusForTransferManually = updatedModel.CheckStatusForTransferManually;
            LatestTransferId = updatedModel.LatestTransferId;
        }
    }
}
