using System.Collections.Generic;
using System.Windows.Forms;
using Hitsuji.Framework.DataClient.Model;
using Hitsuji.Framework.Utils;
using PostCardHitsuji.DataClient.DAO;

namespace PostCardHitsuji.DataClient.Model
{
    public class GroupContentModel : BaseContentModel, IDaoContentModel
    {

        public GroupContentModel()
        {
            Id = "";
            Enable = true.ToString().ToUpper();
            group_ = "";
        }

        public string group
        {
            get { return group_; }
            set
            {
                group_ = ValueUtil.tryGetString(value, "");
            }
        }
        private string group_;

        public override IContentModel DeepCopy()
        {
            GroupContentModel model = new GroupContentModel();
            model.Id = this.Id;
            model.Enable = this.Enable;
            model.group_ = this.group_;
            return model;
        }

        protected override void onBasePropertyChanged(string propertyName, object oldValue, object newValue)
        {
            //throw new System.NotImplementedException();
        }

        public override List<AbsoluteDataResult> IsAbsoluteData()
        {
            var resultList = new List<AbsoluteDataResult>();
            AbsoluteDataResult result = null;
            if (group.Equals(""))
            {
                result = new AbsoluteDataResult();
                result.Result = ResultCodes.IsIrregular;
                result.name = "group";
                result.org = group;
                result.Content = "グループ名が空です。";
                resultList.Add(result);
            }
            return resultList;
        }
    }
}
