using System;
using System.Collections.Generic;
using System.Text;

namespace solarApp.Model
{
    public class PowerStation 
    {
        private string electricityMeterAt = "", tpcContractAt = "", tpcPurchaseElectricityAt = "", tpcSellElectricityAt = "", boeRegisterPostAt = "";

        public int Id { get; set; }
        public byte HealthStatus { get; set; } //狀態
        public int Status { get; set; }//停用啟用
        public int CompanyId { get; set; }
        public int CityId { get; set; } //縣市
        public string CityName { get; set; } //縣市名稱
        public int AreaId { get; set; } //地區
        public string AreaName { get; set; } //地區
        public string Address { get; set; } //地址
        public string Name { get; set; } //名稱
        public string MainDisplay { get; set; } //主要顯示圖片
        public string Code { get; set; } //電站代碼
        public string SerialNumber { get; set; } //四碼流水號
        public byte IsEscrow { get; set; } //是否被代管
        public string EscrowName { get; set; } //被代管公司
        public string ElectricityMeterAt //台電掛錶日
        {
            get
            {
                if (!string.IsNullOrEmpty(electricityMeterAt))
                {
                    return Convert.ToDateTime(electricityMeterAt).ToString("yyyy-MM-dd");
                }
                else
                {
                    return null;
                }
            }
            set { electricityMeterAt = value; }
        }
        public int EstimatedRecoveryTime { get; set; } //預計回收年限
        public double GeneratingCapacity { get; set; } //發電容量
        public double PowerRate { get; set; } //授電費率
        public List<int> OperationPersonnelIds { get; set; } //運維人員編號
        public string Coordinate { get; set; } //座標
        public string InverterBrand { get; set; } //逆變器廠牌
        public string InverterProductModel { get; set; } //逆變器型號
        public int InverterAmount { get; set; } //逆變器數量
        public string PhotovoltaicPanelBrand { get; set; } //光電板廠牌
        public string PhotovoltaicPanelProductModel { get; set; } //光電板型號
        public string PhotovoltaicPanelSpecification { get; set; } //光電板規格
        public int PhotovoltaicPanelAmount { get; set; } //光電板規格
        public string BoEFileName { get; set; } //能源局原檔案名
        public string BoEFile { get; set; } //能源局檔案
        public int BoEDiscountRate { get; set; } //能源局折扣率 
        public string BoEDeviceRegisterNumber { get; set; } //能源局設備登記編號
        public int BoERentRatio { get; set; } //能源局租金比例
        public string BoERegisterPostAt //台電簽約日期
        {
            get
            {
                if (!string.IsNullOrEmpty(boeRegisterPostAt))
                {
                    return Convert.ToDateTime(boeRegisterPostAt).ToString("yyyy-MM-dd");
                }
                else
                {
                    return null;
                }
            }
            set { boeRegisterPostAt = value; }
        }
        public string TPCContractNumber { get; set; } //台電契約編號
        public string TPCContractAt //台電簽約日期
        {
            get
            {
                if (!string.IsNullOrEmpty(tpcContractAt))
                {
                    return Convert.ToDateTime(tpcContractAt).ToString("yyyy-MM-dd");
                }
                else
                {
                    return null;
                }
            }
            set { tpcContractAt = value; }
        }
        public int TPCSellDeadline { get; set; } //台電售電期限(年)
        public int TPCMeterReading { get; set; } //台電每期抄錶日
        public string TPCPurchaseElectricityAt //台電正式購電日
        {
            get
            {
                if (!string.IsNullOrEmpty(tpcPurchaseElectricityAt))
                {
                    return Convert.ToDateTime(tpcPurchaseElectricityAt).ToString("yyyy-MM-dd");
                }
                else
                {
                    return null;
                }
            }
            set { tpcPurchaseElectricityAt = value; }
        }
        public string TPCSellElectricityAt //台電正式售電日
        {
            get
            {
                if (!string.IsNullOrEmpty(tpcPurchaseElectricityAt))
                {
                    return Convert.ToDateTime(tpcPurchaseElectricityAt).ToString("yyyy-MM-dd");
                }
                else
                {
                    return null;
                }
            }
            set { tpcPurchaseElectricityAt = value; }
        }
        public string TPCMeterNumber { get; set; } //台電電號
        public string GUINumber { get; set; }
        public string TPCInvoiceBuyer { get; set; }
        public string TPCInvoiceAddress { get; set; }
        //public List<LandBuilding> LandBuildings { get; set; } //土地房屋資料
        public byte SolarType { get; set; } //電站類型
        public double kwh { get; set; } //
        public double Today_kWh { get; set; } //今日發電量
        public double Total_kWh { get; set; } //總發電量
        public double Today_Money { get; set; } //今日發電金額
        public double Total_Money { get; set; } //總發電金額
        public double Today_kwhkwp { get; set; }
        public double Avg_kwhkwp { get; set; }
        public double Today_PR { get; set; }
        public double Avg_PR { get; set; }
        public double Today_Carbon { get; set; } //今日減碳量
        public double Total_Carbon { get; set; } //總減碳量
        public double Today_irradiance { get; set; } //即時平均日照度
        public double Avg_irradiance { get; set; } //平均日照度(30天)
        public double SolarHour { get; set; } //總運轉小時
        public string SiteDB { get; set; } //電站 DB name: solar_com
        public string TodayWeather { get; set; } //今日天氣
        public double TodayWeatherTemp { get; set; } //今日溫度
        public string WeathersStationId { get; set; }//氣象站編號
        public string RateOfRain { get; set; }//降雨機率
        public string line_token { get; set; }//line_token
        public double Estimate_kwh { get; set; }//預估發電度數
        public double EstimateEfficacy { get; set; }//預估發電效能
        public string Wx { get; set; } //天氣預估
        public string CreatorName { get; set; } //創建者名稱
    }

    public class PowerStationHistory
    {
        public int PowerStationId { get; set; }
        public string Timestamp { get; set; }
        public string SITEID { get; set; }
        public string SiteType { get; set; }
        public double KWH { get; set; }
        public double TodayKWh { get; set; }
        public double TotalKWH { get; set; }
        public double KWHKWP { get; set; }
        public double PR { get; set; }
        public double MP { get; set; }
        public double SolarHour { get; set; }
        public double MONEY { get; set; }
        public double CARBON { get; set; }
        public double TODAYMONEY { get; set; }
        public double TOTALMONEY { get; set; }
        public double TODAYCARBON { get; set; }
        public double TOTALCARBON { get; set; }
        public double Irradiance { get; set; }
        public double Temperature { get; set; }
    }

    public class AvgPowerStationHistory
    {
        public int PowerStationId { get; set; }
        public double AvgKWHKWP { get; set; }
        public double AvgPR { get; set; }
    }

}
