using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using wispro.sp.web.Models;

namespace wispro.sp.web.Services
{
    public class TaskService
    {
        private static ProjectInfo project = new ProjectInfo()
        {
            CaseNo = "WOCN2111703",
            CaseName = "NETWORK SWITCHING METHOD, APPARATUS, USER EQUIPTMENT, AND STORAGE MEDIUM",
            DoItem = "新申请",
            DoPerson = new List<string>() { "李申" },
            ResponseMan = ""
        };

        private List<Models.Task> Tasks = new List<Models.Task>()
        {
            new Models.Task()
                    {
                        Id =1,
                        ProjectInfo = project,
                        Name =$"案件{project.CaseNo}申诉审核",
                        Creater = "李申",
                        ResponseMan ="李丽",
                        LimiteDate = new DateTime(2021,10,20),
                        Type ="申诉审核", CreateTime = DateTime.Now, State="待处理",
                        InputFields = new List<InputField>()
                        {
                            new(){ FieldName ="申诉类型", FieldType="string", FieldValue="案件系数申诉"},
                            new(){ FieldName ="案件系数变更为", FieldType="string", FieldValue="A"}
                        }

                    },
            new Models.Task()
                    {
                        Id = 1,
                        ProjectInfo = project,
                        Name = $"案件{project.CaseNo}申诉审核",
                        Creater = "李申",
                        ResponseMan = "李丽",
                        LimiteDate = new DateTime(2021, 10, 20),
                        Type = "申诉审核",
                        CreateTime = DateTime.Now,
                        State = "待处理",
                        InputFields = new List<InputField>()
                        {
                            new(){ FieldName ="申诉类型", FieldType="string", FieldValue="案件系数申诉"},
                            new(){ FieldName ="处理事项系数变更为", FieldType="string", FieldValue="A"}
                        }

                    }, new Models.Task()
                    {
                        Id = 1,
                        ProjectInfo = project,
                        Name = $"案件{project.CaseNo}申诉审核",
                        Creater = "李申",
                        ResponseMan = "李丽",
                        LimiteDate = new DateTime(2021, 10, 20),
                        Type = "申诉审核",
                        CreateTime = DateTime.Now,
                        State = "待处理",
                        InputFields = new List<InputField>()
                        {
                            new(){ FieldName ="申诉类型", FieldType="string", FieldValue="案件系数申诉"},
                            new(){ FieldName ="处理人变更为", FieldType="string", FieldValue="何倚雯"}
                        }

                    }, new Models.Task()
                    {
                        Id = 1,
                        ProjectInfo = project,
                        Name = $"案件{project.CaseNo}申诉审核",
                        Creater = "李申",
                        ResponseMan = "李丽",
                        LimiteDate = new DateTime(2021, 10, 20),
                        Type = "申诉审核",
                        CreateTime = DateTime.Now,
                        State = "待处理",
                        InputFields = new List<InputField>()
                        {
                            new(){ FieldName ="申诉类型", FieldType="string", FieldValue="案件系数申诉"},
                            new(){ FieldName ="核稿人变更为", FieldType="string", FieldValue="钟子敏"}
                        }

                    }, new Models.Task()
                    {
                        Id = 1,
                        ProjectInfo = project,
                        Name = $"案件{project.CaseNo}申诉审核",
                        Creater = "李申",
                        ResponseMan = "李丽",
                        LimiteDate = new DateTime(2021, 10, 20),
                        Type = "申诉审核",
                        CreateTime = DateTime.Now,
                        State = "待处理",
                        InputFields = new List<InputField>()
                        {
                            new(){ FieldName ="超期原因", FieldType="string", FieldValue="客户看稿超过一个月才回复！"}
                        }

                    }, new Models.Task()
                    {
                        Id = 1,
                        ProjectInfo = project,
                        Name = $"案件{project.CaseNo}申诉审核",
                        Creater = "李申",
                        ResponseMan = "李丽",
                        LimiteDate = new DateTime(2021, 10, 20),
                        Type = "申诉审核",
                        CreateTime = DateTime.Now,
                        State = "待处理",
                        InputFields = new List<InputField>()
                        {
                            new(){ FieldName ="分配比率", FieldType="string", FieldValue="按照李申（2），何倚雯（1）的比例分配！"}
                        }

                    }, new Models.Task()
                    {
                        Id = 1,
                        ProjectInfo = project,
                        Name = $"案件{project.CaseNo}申诉审核",
                        Creater = "李申",
                        ResponseMan = "李丽",
                        LimiteDate = new DateTime(2021, 10, 20),
                        Type = "申诉审核",
                        CreateTime = DateTime.Now,
                        State = "待处理",
                        InputFields = new List<InputField>()
                        {
                            new(){ FieldName ="申诉类型", FieldType="string", FieldValue="缺失案件提报"},
                            new(){ FieldName ="我方文号", FieldType="string", FieldValue="PACN1810394"}                            ,
                            new(){ FieldName ="处理事项", FieldType="string", FieldValue="处理审查意见"}
                        }

                    },new Models.Task()
                    {
                        Id = 1,
                        ProjectInfo = project,
                        Name = $"案件{project.CaseNo}申诉审核",
                        Creater = "李申",
                        ResponseMan = "李丽",
                        LimiteDate = new DateTime(2021, 10, 20),
                        Type = "申诉审核",
                        CreateTime = DateTime.Now,
                        State = "待处理",
                        InputFields = new List<InputField>()
                        {
                            new(){ FieldName ="申诉类型", FieldType="string", FieldValue="涉外案件点数算法备注"},
                            new(){ FieldName ="算法备注", FieldType="string", FieldValue="按字数计算"}                            ,
                            new(){ FieldName ="字数", FieldType="string", FieldValue="18000"}
                        }

                    }
        };

        public Models.Task GetTask(int id)
        {
            if(id <= Tasks.Count)
            {
                return Tasks[id - 1];
            }

            return null;
        }
    }
}
