using System;
using System.Collections.Generic;

namespace Sevomin.Models
{
    public class DovominParameterViewModel
    {
        public string StringValue { get; private set; }

        public long Id { get; set; }
        public long ParameterId { get; set; }
        public string DovominId { get; set; }

        public string ParameterName { get; set; }
        public bool HasMoscow { get; set; }
        public byte DisplayMethod { get; set; }
        public string GroupName { get; set; }

        public string CommentAvalin { get; set; }
        public string CommentDovomin { get; set; }

        public IList<Tuple<decimal,string>> ParameterValues { get; set; }

        public DovominParameterViewModel(DovominParameter dp)
        {
            StringValue = dp.StringValue;

            Id = dp.Id;
            ParameterId = dp.Parameter.Id;
            DovominId = dp.Dovomin.Id;

            ParameterName = dp.Parameter.Name;
            HasMoscow = dp.Parameter.Moscow;
            DisplayMethod = dp.Parameter.DisplayMethod;
            GroupName = dp.Parameter.GroupName;

            CommentAvalin = dp.Parameter.CommentAvalin;
            CommentDovomin = dp.Parameter.CommentDovomin;

            ParameterValues = new List<Tuple<decimal, string>>();
            foreach (var val in dp.Parameter.ParameterValues)
            {
                ParameterValues.Add(new Tuple<decimal, string>(val.NumbericValue, val.Value));
            }
        }
    }
}
