using AutoTurnOver.Models.Report;
using System;
using System.Collections.Generic;
using System.Text;

namespace AutoTurnOver.Models
{
    public class transfer_profit_result_dto
    {
        public List<transfer_profit_dto> datas { get; set; }
        /// <summary>
        /// 今日数据
        /// </summary>
        public transfer_profit_modal_dto today_data { get; set; }
    }
    public class transfer_profit_dto
    {
        public string name { get; set; }
        public string field_name { get; set; }
        public string remarks { get; set; }
        public List<day_dto> days { get; set; }
       

        public class day_dto
        {
            public bool has_int { get; set; }

            /// <summary>
            /// 计算公式
            /// </summary>
            public string formula { get; set; }
            public DateTime date { get; set; }
            public string date_str { get {
                    return date.ToString("MM-dd"+$"({Sinicization(date.DayOfWeek)})");
                } }

            public decimal? val { get; set; }
            public string val_str { get {
                    if (val == null) return "-";
                    if (has_int)
                    {
                        return (val ?? 0).ToString();
                    }
                    else
                    {
                        return Math.Round((val ?? 0),2).ToString("N");
                    }
                    
                } }
        }

        public static string Sinicization(DayOfWeek week)
        {
            switch (week)
            {
                case DayOfWeek.Friday:
                    return "周五";
                case DayOfWeek.Monday:
                    return "周一";
                case DayOfWeek.Saturday:
                    return "周六";
                case DayOfWeek.Sunday:
                    return "周日";
                case DayOfWeek.Thursday:
                    return "周四";
                case DayOfWeek.Tuesday:
                    return "周二";
                case DayOfWeek.Wednesday:
                    return "周三";
                default:
                    return "";
                    break;
            }
        }
    }
}
