using ReactiveUI;

namespace Valg.EVA.Skanning.JobManagement.Startup.Data
{
    public class PollingDistrictModel : ReactiveObject, IUpdatable<PollingDistrictModel, string>
    {
        private Valg.EVA.Skanning.ServicesModel.ElectionConfig.Model.VotingCategory votingCategory;
        private string name;
        private string id;
        
        public string Id
        {
            get { return id; }
            set { this.RaiseAndSetIfChanged(ref id, value); }
        }

        public string Name
        {
            get { return name; }
            set { this.RaiseAndSetIfChanged(ref name, value); }
        }
        public Valg.EVA.Skanning.ServicesModel.ElectionConfig.Model.VotingCategory VotingCategory
        {
            get { return votingCategory; }
            set { this.RaiseAndSetIfChanged(ref votingCategory, value); }
        }

        public void Update(PollingDistrictModel updatedModel)
        {
            Name = updatedModel.Name;
        }

        string IUpdatable<PollingDistrictModel, string>.Id
        {
            get { return VotingCategory.Code + VotingCategory.Id; }
        }
    }
}

