using Ewide.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ewide.Application
{
    public class HouseCompanyInput
    {
        [Required(ErrorMessage = "Id不能为空")]
        public string Id { get; set; }
    }

    public class HouseCompanyInfoInput
    {
        [Required(ErrorMessage = "信息名称不能为空")]
        public string Name { get; set; }
        [Required(ErrorMessage = "信息内容不能为空")]
        public string Value { get; set; }
    }

    public class HouseCompanyPageInput : PageInputBase {}

    public class HouseCompanyAddInput
    {
        [Required(ErrorMessage = "名称不能为空")]
        public virtual string Name { get; set; }

        private string _Type { get; set; }

        [Required(ErrorMessage = "类型不能为空")]
        public virtual string Type
        {
            get
            {
                return _Type;
            }
            set
            {
                _Type = String.Join(",", value.Split(',').Select(p => $"[{p}]"));
            }
        }

        public virtual List<HouseCompanyInfoInput> Info { get; set; }
    }

    public class HouseCompanyEditInput : HouseCompanyAddInput
    {
        [Required(ErrorMessage = "Id不能为空")]
        public string Id { get; set; }
    }

    public class HouseCompanyListInput
    {
        [Required(ErrorMessage = "类型不能为空")]
        public string Type { get; set; }
    }
}
