using OASystem.Domain.Entities.PersonnelModule;
using OASystem.Domain.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OASystem.Domain.ViewModels.PersonnelModule
{
    /// <summary>
    /// 任务分配View
    /// </summary>
    public class TaskAllocationView: Pm_TaskAllocation
    {
    }

    /// <summary>
    /// 任务分配
    /// 基础数据 View
    /// </summary>
    public class InitView
    {
        /// <summary>
        /// 任务操作权限
        /// </summary>
        public TaskOperationAudit TaskOperationAudit { get; set; }
        /// <summary>
        /// 任务名称 Items
        /// </summary>
        public List<string>? TaskNameInfos { get; set; }

        /// <summary>
        /// 执行任务人员信息 Items
        /// </summary>
        public List<ExecuteTaskUserInfo>? ExecuteTaskUserInfos { get; set; }

        public List<ValueInfo>? GroupNameInfos { get; set; }
        public ValueInfo? DepartmentNameInfo { get; set; }

    }

    /// <summary>
    /// 预览信息
    /// </summary>
    public class ValueInfo
    {
        public int Id { get; set; }

        public string Name { get; set; }
    }

    /// <summary>
    /// 执行任务人员信息
    /// </summary>
    public class ExecuteTaskUserInfo
    {
        public int Id { get; set; }

        /// <summary>
        /// 姓名
        /// </summary>
        public string? Name { get; set; }

        /// <summary>
        /// 公司名称
        /// </summary>
        public string? CompanyName { get; set; }

        /// <summary>
        /// 部门名称
        /// </summary>
        public string? DepartmentName { get; set; }

        /// <summary>
        /// 职位名称
        /// </summary>
        public string? JobName { get; set; }
    }

    /// <summary>
    /// 任务操作权限
    /// </summary>
    public class TaskOperationAudit
    {
        /// <summary>
        /// 任务添权限
        /// 0 否 1 是
        /// </summary>
        public int TaskAddAudit { get; set; } = 0;

        /// <summary>
        /// 任务删除权限
        /// 0 否 1 是
        /// </summary>
        public int TaskDelAudit { get; set; } = 0;

        /// <summary>
        /// 任务终止权限
        /// 0 否 1 是
        /// </summary>
        public int TasStopAudit { get; set; } = 0;

        /// <summary>
        /// 任务确认权限
        /// 0 否 1 是
        /// </summary>
        public int TaskComfirmAudit { get; set; } = 0;

        /// <summary>
        /// 任务评分权限
        /// 0 否 1 是
        /// </summary>
        public int TaskScoreAudit { get; set; } = 0;
    }

    /// <summary>
    /// 任务指派
    /// Item View
    /// </summary>
    public class TaskListView
    {
        public int RowNumber { get; set; }

        public int Id { get; set; }

        /// <summary>
        /// 任务名称
        /// </summary>
        public string? TaskName { get; set; }

        /// <summary>
        /// 任务等级
        /// </summary>
        public int TaskPriority { get; set; }

        /// <summary>
        /// 归属部门
        /// </summary>
        public string? DepName { get; set; }

        /// <summary>
        /// 归属团组
        /// </summary>
        public string? TeamName { get; set; }

        /// <summary>
        /// 任务状态
        /// </summary>
        public int Status { get; set; }

        /// <summary>
        /// 任务发布人
        /// </summary>
        public string? CreateUserName { get; set; }

        /// <summary>
        /// 任务发布时间
        /// </summary>
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// 预计开始时间
        /// </summary>
        public string? PredictBeginTime { get; set; }

        /// <summary>
        /// 预计开始时间
        /// </summary>
        public string? PredictEndTime { get; set; }
        /// <summary>
        /// 任务参与者
        /// </summary>
        public string? Participant { get; set; }

        /// <summary>
        /// 任务完成者
        /// </summary>
        public string? Consummator { get; set; }

        public List<TaskerDetailsView>? TaskerDetails { get; set; }
    }

    /// <summary>
    /// 详情
    /// </summary>
    public class TaskDetailsView
    {
        public int Id { get; set; }

        public int DiId { get; set; }

        //public string TeamName { get; set; }

        /// <summary>
        /// 任务部门Id 
        /// </summary>
        public int DepId { get; set; }

        //public string DepName { get; set; }

        public int CreateUserId { get; set; }
        //public string CreateUserName { get; set; }

        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// 任务名称
        /// </summary>
        public string? TaskName { get; set; }

        /// <summary>
        /// 任务内容
        /// </summary>
        public string? TaskContent { get; set; }

        /// <summary>
        /// 优先级
        /// 1 2 3 4
        /// </summary>
        public int TaskPriority { get; set; }

        /// <summary>
        /// 任务预计开始时间(由发布者设置开始时间)
        /// </summary>
        public string? PredictBeginTime { get; set; }

        /// <summary>
        /// 任务预计结束时间(由发布者设置结束时间)
        /// </summary>
        public string? PredictEndTime { get; set; }

        /// <summary>
        /// 0 否 1 是  
        /// 是否纳入绩效考核
        /// </summary>
        public int IsIntoPerformance { get; set; }

        /// <summary>
        /// 人员任务
        /// </summary>
        public List<TaskUserDetailsView>? UserTaskInfos { get; set; }

        public string Remark { get; set; }
    }


    /// <summary>
    /// 任务者-详情
    /// </summary>
    public class TaskerDetailsView
    {
        public int TAId { get; set; }
        public int TaskCreateUserId { get; set; }
        public int Id { get; set; }

        public int UserId { get; set; }
        public string UserName { get; set; }

        /// <summary>
        /// 实际开始时间
        /// </summary>
        public string BeginTime { get; set; }

        public string OverTime { get; set; }

        /// <summary>
        /// -1 未开始 0 已知晓 1 进行中 2 待审核 3 未完成  4 已完成 5任务中止
        /// </summary>
        public int TaskStatus { get; set; }

        /// <summary>
        /// 未完成原因
        /// </summary>
        public string Cause { get; set; }

        /// <summary>
        /// 评分
        /// </summary>
        public int Score { get; set; }

        /// <summary>
        /// 评分备注
        /// </summary>
        public string ScoreRemark { get; set; }
    }


    /// <summary>
    /// 任务参与人
    /// </summary>
    public class TaskUserDetailsView 
    {
        public int Id { get; set; }

        public int TAId { get; set; }

        public int UserId { get; set; }
        //public string UserName { get; set; }

        /// <summary>
        /// 实际开始时间
        /// </summary>
        public string BeginTime { get; set; }

        /// <summary>
        /// 实际完成时间
        /// </summary>
        public string OverTime { get; set; }

        /// <summary>
        /// 任务状态
        /// </summary>
        public TaskerEnum TaskStatus { get; set; }

        /// <summary>
        /// 未完成原因
        /// </summary>
        public string Cause { get; set; }

        /// <summary>
        /// 评分备注
        /// </summary>
        public string Remark { get; set; }
    }
}
