import { download, requestAccess, serviceAccess } from "./request";
/**
 * @typedef projectData
 * 璧涙紨缁熻-椤圭洰鍒楄〃
 * @type {object}
 * @property {string} id 椤圭洰id
 * @property {string | undefined} itemDomainId 缁勭粐id
 * @property {string | undefined} itemDomainName 缁勭粐鍚嶇О
 * @property {string | undefined} itemProjectEndTime 椤圭洰缁撴潫鏃堕棿
 * @property {string | undefined} itemProjectName 椤圭洰鍚嶇О
 *
 */

/**
 * 璧涙紨缁熻-椤圭洰鍒楄〃
 * 杩欎釜鎺ュ彛杩斿洖鍊间笉绗﹀悎code,data瑙勮寖锛屾墍浠ヤ笉鐢╮equestAccess
 * @returns {projectData}
 */
export const getProject = () => {
  return serviceAccess({
    url: "/sy/statistics/project",
    method: "post",
    data: {},
  });
};
/**
 * @typedef siteData
 * 璧涙紨缁熻-鑰冨嫟缁勶紙宀楃偣锛夊垪琛�
 * @type {object}
 * @property {string | undefined} domainid 缁勭粐id
 * @property {string} id 鑰冨嫟缁勶紙宀楃偣锛塱d
 * @property {string | undefined} itemAttType 鑰冨嫟绫诲瀷
 * @property {string | undefined} itemAttendanceEndDate 鑰冨嫟缁撴潫鏃堕棿
 * @property {string | undefined} itemAttendanceSiteFullAddress 鑰冨嫟鍦扮偣鍏ㄧО
 * @property {number | undefined} itemAttendanceSiteLatitude 鑰冨嫟鍦扮偣绾害
 * @property {number | undefined} itemAttendanceSiteLongitude 鑰冨嫟鍦扮偣缁忓害
 * @property {string | undefined} itemAttendanceSiteName 鑰冨嫟鍦扮偣鍚嶇О
 * @property {string | undefined} itemAttendanceSiteState 鑰冨嫟鍦扮偣鐘舵€�
 * @property {string | undefined} itemAttendanceStartDate 鑰冨嫟寮€濮嬫椂闂�
 * @property {string | undefined} itemIsdeleted 鏄惁鍒犻櫎
 * @property {number | undefined} itemPerformRange 鑰冨嫟鑼冨洿
 * @property {string | undefined} itemPrincipal 璐熻矗浜�
 * @property {string | undefined} itemProjectId 椤圭洰id
 *
 * */

/**
 * @typedef siteParams
 * 璧涙紨缁熻-鑰冨嫟缁勶紙宀楃偣锛夊垪琛� 鎺ュ彛鍙傛暟
 * @type {object}
 * @property {string} projectId 椤圭洰id
 * @property {string[]} teamIdList 鍥㈤槦缁勭粐id鍒楄〃锛屾暟缁勶紙鏄敤鑾峰彇鍥㈤槦鍒楄〃鎺ュ彛鐨刬temTeamId瀛楁锛屼笉瑕佺敤id锛�
 *
 * */

/**
 * 璧涙紨缁熻-鑰冨嫟缁勶紙宀楃偣锛夊垪琛�
 * @param {siteParams} data
 * @returns {siteData}
 */
export const getSite = (data) => {
  return requestAccess({
    url: "/sy/statistics/site",
    method: "post",
    data,
  });
};
/**
 * @typedef teamDataParams
 * 璧涙紨缁熻-鍥㈤槦鍒楄〃 鎺ュ彛鍙傛暟
 * @type {object}
 * @property {string} projectId 椤圭洰id
 */

/**
 * @typedef teamData
 * 璧涙紨缁熻-鍥㈤槦鍒楄〃
 * @type {object}
 * @property {string} id 鍥㈤槦id
 * @property {string | undefined} itemProjectId 椤圭洰id
 * @property {string} itemTeamId 鍥㈤槦缁勭粐id
 * @property {string | undefined} itemTeamName 鍥㈤槦缁勭粐鍚嶇О
 */

/**
 * 璧涙紨缁熻-鍥㈤槦鍒楄〃
 * @param {teamDataParams} data
 * @returns {teamData}
 */
export const getTeam = (data) => {
  return requestAccess({
    url: "/sy/statistics/team",
    method: "post",
    data,
  });
};

/**
 * @typedef attendanceParams
 * 璧涙紨鑰冨嫟缁熻 鎺ュ彛鍙傛暟
 * @type {object}
 * @property {string} projectId 椤圭洰id
 * @property {string[]} siteIdList 鑰冨嫟缁勶紙宀楃偣锛塱d鍒楄〃锛屾暟缁�
 * @property {string[]} teamIdList 鍥㈤槦缁勭粐id鍒楄〃锛屾暟缁�
 * @property {string} statisticsStartTime 缁熻寮€濮嬫椂闂达紝yyyy-MM-dd
 * @property {string} statisticsEndTime 缁熻缁撴潫鏃堕棿锛寉yyy-MM-dd
 * @property {string} userName 濮撳悕
 * @property {number} pageNum 椤电爜
 * @property {number} pageSize 姣忛〉鏁伴噺
 * @property {string} orderByColumn 鎺掑簭瀛楁
 * @property {string} isAsc 鎺掑簭鏂瑰紡锛宎sc鍗囧簭锛宒esc闄嶅簭
 * @property {boolean} reasonable 鏄惁鍚堢悊锛宼rue鏄紝false鍚�
 * @property {number} operateType 鎿嶄綔绫诲瀷(绛惧埌缁熻)锛�0锛氱鍒帮紝1锛氱閫€
 *
 */

/**
 * @typedef attendanceData
 * 璧涙紨鑰冨嫟缁熻
 * @type {object}
 * @property {number} abnormalPeopleNumber 寮傚父浜烘暟
 * @property {number} actualAttendanceTime 瀹為檯鍑哄嫟鏃堕棿
 * @property {number} actualClockInCount 瀹為檯绛惧埌娆℃暟
 * @property {number} entid
 * @property {string} groupName 鑰冨嫟缁勫悕绉�
 * @property {number} lateCount 杩熷埌娆℃暟
 * @property {number} latePeopleNumber 杩熷埌浜烘暟
 * @property {number} leaveEarlyCount 鏃╅€€娆℃暟
 * @property {number} leaveEarlyPeopleNumber 鏃╅€€浜烘暟
 * @property {number} leaveTime 璇峰亣鏃堕棿
 * @property {number} missingCount 缂哄嫟娆℃暟
 * @property {number} normalPeopleNumber 姝e父浜烘暟
 * @property {string} projectName 椤圭洰鍚嶇О
 * @property {string} shiftName 鐝鍚嶇О
 * @property {number} shouldAttendanceTime 搴斿嚭鍕ゆ椂闂�
 * @property {number} shouldClockInCount 搴旂鍒版鏁�
 * @property {string} statisticsDate 缁熻鏃ユ湡
 * @property {string} teamName 鍥㈤槦缁勭粐鍚嶇О
 * @property {string} userName 濮撳悕
 * @property {number} workOvertime 鍔犵彮鏃堕棿
 *
 */

/**
 * 璧涙紨鑰冨嫟缁熻
 * @param {attendanceParams} data
 * @returns {attendanceData}
 */
export const attendanceList = (data) => {
  return requestAccess({
    url: "/sy/statistics/attendance",
    method: "post",
    data,
  });
};

/**
 * 瀵煎嚭鑰冨嫟缁熻
 * @param {attendanceParams} data
 * @returns
 */
export const attendanceExport = (data) => {
  return download("/sy/statistics/attendance/excel", data, "鑰冨嫟缁熻.xlsx");
};

/**
 * @typedef singInData
 * 璧涙紨绛惧埌缁熻
 * @type {object}
 * @property {string} employeeId 鑱屽憳id
 * @property {string} operateAddress 鎿嶄綔鍦板潃
 * @property {number} operateCount 鎿嶄綔娆℃暟
 * @property {string} operateName 鎿嶄綔绫诲瀷-涓枃
 * @property {string} operateTime 鎿嶄綔鏃堕棿
 * @property {string} operateType 鎿嶄綔绫诲瀷锛�0锛氱鍒帮紝1锛氱閫€
 * @property {string} projectName 椤圭洰鍚嶇О
 * @property {string} siteName 宀楃偣鍚嶇О
 * @property {string} statisticsDate 缁熻鏃ユ湡
 * @property {string} teamName 鍥㈤槦缁勭粐鍚嶇О
 * @property {string} userName
 *
 */

/**
 * 璧涙紨绛惧埌缁熻
 * @param {attendanceParams} data
 * @returns {singInData}
 */
export const signInList = (data) => {
  return requestAccess({
    url: "/sy/statistics/sign/in",
    method: "post",
    data,
  });
};

/**
 * 绛惧埌缁熻瀵煎嚭
 * @param {attendanceParams} data
 * @returns
 */
export const signInExport = (data) => {
  return download("/sy/statistics/sign/in/excel", data, "绛惧埌缁熻.xlsx");
};