using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace SolarPower.Models
{
    /// <summary>
    /// 基礎BaseModel
    /// </summary>
    public class MyBaseModel
    {
        public int Id { get; set; } //編號
    }

    public class Created
    {
        private string createdAt;

        public int CreatedBy { get; set; } //創建者
        public string CreatedAt { get { return Convert.ToDateTime(createdAt).ToString("yyyy-MM-dd HH:mm:ss"); } set { createdAt = value; } } //創建時間
    }

    public class Updated : MyBaseModel
    {
        private string updatedAt;
        public int UpdatedBy { get; set; } //修改者
        public string UpdatedAt { get { return Convert.ToDateTime(updatedAt).ToString("yyyy-MM-dd HH:mm:ss"); } set { updatedAt = value; } } //修改時間
    }

    public class UserInfo : MyBaseModel //Created，Updated MIX
    {
        private string createdAt;
        public int CreatedBy { get; set; } //創建者
        public string CreatedAt { get { return Convert.ToDateTime(createdAt).ToString("yyyy-MM-dd HH:mm:ss"); } set { createdAt = value; } } //創建時間
        private string updatedAt;
        public int UpdatedBy { get; set; } //修改者
        public string UpdatedAt { get { return Convert.ToDateTime(updatedAt).ToString("yyyy-MM-dd HH:mm:ss"); } set { updatedAt = value; } } //修改時間
    }

    /// <summary>
    /// 當前登入的使用者基本資訊
    /// </summary>
    public class MyUser
    {
        public int Id { get; set; } //編號
        public byte Status { get; set; } //狀態
        public string Name { get; set; } //姓名
        public int CompanyId { get; set; } //公司編號
        public int RoleId { get; set; } //角色編號
        public string Email { get; set; }
        public MyCompany Company { get; set; } //公司資訊
        public MyRole Role { get; set; } //角色資訊
    }

    /// <summary>
    /// 當前登入使用者的公司資訊
    /// </summary>
    public class MyCompany
    {
        private string logo;
        public int Id { get; set; }
        public byte Status { get; set; } //狀態
        public string Name { get; set; } //名稱
        public string Logo { get { return "/upload/company_logo/" + logo; } set { logo = value; } }
    }

    //當前登入使用者的角色權限
    public class MyRole
    {
        public int Id { get; set; }
        public string Name { get; set; } //名稱
        public byte Layer { get; set; } //角色層級
        public List<string> Auths { get; set; } //可操作頁面
    }

    public class MyPowerStationInfo
    {
        public int Id { get; set; }
        public int CityId { get; set; }
        public string CityName { get; set; }
        public string Name { get; set; }
    }

    public class MyPowerStationSummary
    {
        public string CityName { get; set; }
        public int Amount { get; set; }
        public List<MyPowerStation> MyPowerStations { get; set; }
    }

    public class MyPowerStation
    {
        public int PowerStationId { get; set; }
        public string PowerStationName { get; set; }
    }

    public class Variable
    {
        public string Name { get; set; }
        public string Value { get; set; }
    }

    public class CheckBox
    {
        public int Value { get; set; } //通常放id
        public string Name { get; set; }
    }
}
