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

namespace OASystem.Domain.ViewModels.QiYeWeChat
{
    /// <summary>
    /// 企业微信 API
    /// 打卡月数据
    /// </summary>
    public class CheckInView:ResponseBase
    {
        /// <summary>
        /// 基础信息
        /// </summary>
        public List<Data>? datas { get; set; }
    }

    /// <summary>
    /// 基础信息 Data
    /// </summary>
    public class Data
    {
        /// <summary>
        /// 基础信息
        /// </summary>
        public Base_Info? base_info { get; set; }

        /// <summary>
        /// 汇总信息
        /// </summary>
        public Summary_Info? summary_info { get; set; }

        /// <summary>
        /// 异常状态统计信息
        /// </summary>
        public List<Exception_Info>? exception_infos { get; set; }

        /// <summary>
        /// 假勤统计信息
        /// </summary>
        public List<Sp_Item>? sp_items { get; set; }

        /// <summary>
        /// 加班情况
        /// </summary>
        public Overwork_Info? overwork_info { get; set; }
    }

    /// <summary>
    /// 成员基础信息
    /// </summary>
    public class Base_Info
    {
        /// <summary>
        /// 记录类型：1-固定上下班；2-外出（此报表中不会出现外出打卡数据）；3-按班次上下班；4-自由签到；5-加班；7-无规则
        /// </summary>
        public int record_type { get; set; }

        /// <summary>
        /// 打卡人员姓名
        /// </summary>
        public string? name { get; set; }

        /// <summary>
        /// 打卡人员别名
        /// </summary>
        public string? name_ex { get; set; }

        /// <summary>
        /// 打卡人员所在部门，会显示所有所在部门
        /// </summary>
        public string? departs_name { get; set; }

        /// <summary>
        /// 打卡人员账号，即userid
        /// </summary>
        public string? acctid { get; set; }

        /// <summary>
        /// 打卡人员所属规则信息
        /// </summary>
        public Rule_Info? rule_info { get; set; }
    }

    /// <summary>
    /// 打卡人员所属规则信息
    /// </summary>
    public class Rule_Info
    {
        /// <summary>
        /// 所属规则的id
        /// </summary>
        public int groupid { get; set; }

        /// <summary>
        /// 打卡规则名
        /// </summary>
        public string? groupname { get; set; }

    }

    /// <summary>
    /// 汇总信息
    /// </summary>
    public class Summary_Info
    {
        /// <summary>
        /// 应打卡天数
        /// </summary>
        public int work_days { get; set; }

        /// <summary>
        /// 正常天数
        /// </summary>
        public int regular_days { get; set; }

        /// <summary>
        /// 异常天数
        /// </summary>
        public int except_days { get; set; }

        /// <summary>
        /// 实际工作时长，为统计周期每日实际工作时长之和
        /// </summary>
        public int regular_work_sec { get; set; }

        /// <summary>
        /// 标准工作时长，为统计周期每日标准工作时长之和
        /// </summary>
        public int standard_work_sec { get; set; }
    }

    /// <summary>
    /// 异常状态统计信息
    /// </summary>
    public class Exception_Info
    {
        /// <summary>
        /// 异常类型：1-迟到；2-早退；3-缺卡；4-旷工；5-地点异常；6-设备异常
        /// </summary>
        public int exception { get; set; }

        /// <summary>
        /// 异常次数，为统计周期内每日此异常次数之和
        /// </summary>
        public int count { get; set; }

        /// <summary>
        /// 异常时长（迟到/早退/旷工才有值），为统计周期内每日此异常时长之和
        /// </summary>
        public int duration { get; set; }
    }

    /// <summary>
    /// 假勤统计信息
    /// </summary>
    public class Sp_Item
    {
        /// <summary>
        /// 假勤类型：1-请假；2-补卡；3-出差；4-外出；100-外勤
        /// </summary>
        public int type { get; set; }

        /// <summary>
        /// 具体请假类型，当type为1请假时，具体的请假类型id，可通过审批相关接口获取假期详情
        /// </summary>
        public int vacation_id { get; set; }

        /// <summary>
        /// 假勤次数，为统计周期内每日此假勤发生次数之和
        /// </summary>
        public int count { get; set; }

        /// <summary>
        /// 假勤时长，为统计周期内每日此假勤发生时长之和，时长单位为天直接除以86400即为天数，单位为小时直接除以3600即为小时数
        /// </summary>
        public int duration { get; set; }

        /// <summary>
        /// 时长单位：0-按天 1-按小时
        /// </summary>
        public int time_type { get; set; }

        /// <summary>
        /// 统计项名称
        /// </summary>
        public string? name { get; set; }
    }

    /// <summary>
    /// 加班情况
    /// </summary>
    public class Overwork_Info
    {
        /// <summary>
        /// 工作日加班时长
        /// </summary>
        public int? workday_over_sec { get; set; }

        /// <summary>
        /// 节假日加班时长
        /// </summary>
        public int? holidays_over_sec { get; set; }

        /// <summary>
        /// 休息日加班时长
        /// </summary>
        public int? restdays_over_sec { get; set; }
    }
}
