// Code generated by lark_sdk_gen. DO NOT EDIT.
/**
 * Copyright 2022 chyroc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package lark

import (
	"context"
)

// GetAttendanceLeaveEmployExpireRecord 只能获取到对应时间段过期的发放记录
//
// 仅飞书人事企业版可用
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/leave_employ_expire_record/get
// new doc: https://open.feishu.cn/document/server-docs/attendance-v1/leave_employ_expire_record/get
func (r *AttendanceService) GetAttendanceLeaveEmployExpireRecord(ctx context.Context, request *GetAttendanceLeaveEmployExpireRecordReq, options ...MethodOptionFunc) (*GetAttendanceLeaveEmployExpireRecordResp, *Response, error) {
	if r.cli.mock.mockAttendanceGetAttendanceLeaveEmployExpireRecord != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Attendance#GetAttendanceLeaveEmployExpireRecord mock enable")
		return r.cli.mock.mockAttendanceGetAttendanceLeaveEmployExpireRecord(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Attendance",
		API:                   "GetAttendanceLeaveEmployExpireRecord",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/attendance/v1/leave_employ_expire_records/:leave_id",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
	}
	resp := new(getAttendanceLeaveEmployExpireRecordResp)

	response, err := r.cli.RawRequest(ctx, req, resp)
	return resp.Data, response, err
}

// MockAttendanceGetAttendanceLeaveEmployExpireRecord mock AttendanceGetAttendanceLeaveEmployExpireRecord method
func (r *Mock) MockAttendanceGetAttendanceLeaveEmployExpireRecord(f func(ctx context.Context, request *GetAttendanceLeaveEmployExpireRecordReq, options ...MethodOptionFunc) (*GetAttendanceLeaveEmployExpireRecordResp, *Response, error)) {
	r.mockAttendanceGetAttendanceLeaveEmployExpireRecord = f
}

// UnMockAttendanceGetAttendanceLeaveEmployExpireRecord un-mock AttendanceGetAttendanceLeaveEmployExpireRecord method
func (r *Mock) UnMockAttendanceGetAttendanceLeaveEmployExpireRecord() {
	r.mockAttendanceGetAttendanceLeaveEmployExpireRecord = nil
}

// GetAttendanceLeaveEmployExpireRecordReq ...
type GetAttendanceLeaveEmployExpireRecordReq struct {
	LeaveID             string  `path:"leave_id" json:"-"`               // 假期类型ID, 示例值: "7111688079785723436"
	UserIDType          *IDType `query:"user_id_type" json:"-"`          // 用户 ID 类型, 示例值: open_id, 可选值有: open_id: 标识一个用户在某个应用中的身份。同一个用户在不同应用中的 Open ID 不同。[了解更多: 如何获取 Open ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-openid), union_id: 标识一个用户在某个应用开发商下的身份。同一用户在同一开发商下的应用中的 Union ID 是相同的, 在不同开发商下的应用中的 Union ID 是不同的。通过 Union ID, 应用开发商可以把同个用户在多个应用中的身份关联起来。[了解更多: 如何获取 Union ID？](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-union-id), user_id: 标识一个用户在某个租户内的身份。同一个用户在租户 A 和租户 B 内的 User ID 是不同的。在同一个租户内, 一个用户的 User ID 在所有应用（包括商店应用）中都保持一致。User ID 主要用于在不同的应用间打通用户数据。[了解更多: 如何获取 User ID？](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-user-id), people_corehr_id: 以飞书人事的ID来识别用户, 默认值: `open_id`, 当值为 `user_id`, 字段权限要求: 获取用户 user ID
	EmploymentID        string  `json:"employment_id,omitempty"`         // 员工ID, 示例值: "6982509313466189342"
	LeaveTypeID         string  `json:"leave_type_id,omitempty"`         // 假期类型ID, 示例值: "7111688079785723436"
	StartExpirationDate string  `json:"start_expiration_date,omitempty"` // 失效最早日期  2023-04-10 格式, 示例值: "2023-04-10"
	EndExpirationDate   string  `json:"end_expiration_date,omitempty"`   // 失效最晚日期 2023-05-10 格式, 示例值: "2023-05-10"
	TimeOffset          *int64  `json:"time_offset,omitempty"`           // 时间偏移, 东八区: 480    8*60, 如果没有这个参数, 默认东八区, 示例值: 480
}

// GetAttendanceLeaveEmployExpireRecordResp ...
type GetAttendanceLeaveEmployExpireRecordResp struct {
	Records []*GetAttendanceLeaveEmployExpireRecordRespRecord `json:"records,omitempty"` // 员工过期日期的发放记录
}

// GetAttendanceLeaveEmployExpireRecordRespRecord ...
type GetAttendanceLeaveEmployExpireRecordRespRecord struct {
	ID                   string                                                  `json:"id,omitempty"`                     // record id
	EmploymentID         string                                                  `json:"employment_id,omitempty"`          // 员工ID
	LeaveTypeID          string                                                  `json:"leave_type_id,omitempty"`          // 假期类型ID
	GrantingQuantity     string                                                  `json:"granting_quantity,omitempty"`      // 发放余额数量
	LeftGrantingQuantity string                                                  `json:"left_granting_quantity,omitempty"` // 发放数量 扣减完后的发放数量
	GrantingUnit         int64                                                   `json:"granting_unit,omitempty"`          // 发放单位, 1表示天, 2表示小时
	EffectiveDate        string                                                  `json:"effective_date,omitempty"`         // 生效日期, 格式"2020-01-01"
	ExpirationDate       string                                                  `json:"expiration_date,omitempty"`        // 失效日期, 格式"2020-01-01"
	Reason               []*GetAttendanceLeaveEmployExpireRecordRespRecordReason `json:"reason,omitempty"`                 // 发放原因
	IsUpdateByExternal   bool                                                    `json:"is_update_by_external,omitempty"`  // 是否已经被外部系统更改过
	AccrualSource        int64                                                   `json:"accrual_source,omitempty"`         // 发放来源, 可选值有: 1: 系统发放, 2: 人工发放, 3: 外部系统发放, 4: 虚拟发放, 5: 旧系统导入, 6: 加班转入
	LeaveSubTypeID       string                                                  `json:"leave_sub_type_id,omitempty"`      // 假期子类型id
}

// GetAttendanceLeaveEmployExpireRecordRespRecordReason ...
type GetAttendanceLeaveEmployExpireRecordRespRecordReason struct {
	Lang  string `json:"lang,omitempty"`  // 语言码
	Value string `json:"value,omitempty"` // 语言码对应的文本
}

// getAttendanceLeaveEmployExpireRecordResp ...
type getAttendanceLeaveEmployExpireRecordResp struct {
	Code  int64                                     `json:"code,omitempty"` // 错误码, 非 0 表示失败
	Msg   string                                    `json:"msg,omitempty"`  // 错误描述
	Data  *GetAttendanceLeaveEmployExpireRecordResp `json:"data,omitempty"`
	Error *ErrorDetail                              `json:"error,omitempty"`
}
