// 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"
)

// UpdateAttendanceRemedyApproval 对于只使用飞书考勤系统而未使用飞书审批系统的企业, 可以通过该接口更新写入飞书考勤系统中的三方系统审批状态, 例如请假、加班、外出、出差、补卡等审批, 状态包括通过、不通过、撤销等。
//
// 发起状态的审批才可以被更新为通过、不通过, 已经通过的审批才可以被更新为撤销。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/approval_info/process
// new doc: https://open.feishu.cn/document/server-docs/attendance-v1/user_approval/process
func (r *AttendanceService) UpdateAttendanceRemedyApproval(ctx context.Context, request *UpdateAttendanceRemedyApprovalReq, options ...MethodOptionFunc) (*UpdateAttendanceRemedyApprovalResp, *Response, error) {
	if r.cli.mock.mockAttendanceUpdateAttendanceRemedyApproval != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Attendance#UpdateAttendanceRemedyApproval mock enable")
		return r.cli.mock.mockAttendanceUpdateAttendanceRemedyApproval(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Attendance",
		API:                   "UpdateAttendanceRemedyApproval",
		Method:                "POST",
		URL:                   r.cli.openBaseURL + "/open-apis/attendance/v1/approval_infos/process",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
	}
	resp := new(updateAttendanceRemedyApprovalResp)

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

// MockAttendanceUpdateAttendanceRemedyApproval mock AttendanceUpdateAttendanceRemedyApproval method
func (r *Mock) MockAttendanceUpdateAttendanceRemedyApproval(f func(ctx context.Context, request *UpdateAttendanceRemedyApprovalReq, options ...MethodOptionFunc) (*UpdateAttendanceRemedyApprovalResp, *Response, error)) {
	r.mockAttendanceUpdateAttendanceRemedyApproval = f
}

// UnMockAttendanceUpdateAttendanceRemedyApproval un-mock AttendanceUpdateAttendanceRemedyApproval method
func (r *Mock) UnMockAttendanceUpdateAttendanceRemedyApproval() {
	r.mockAttendanceUpdateAttendanceRemedyApproval = nil
}

// UpdateAttendanceRemedyApprovalReq ...
type UpdateAttendanceRemedyApprovalReq struct {
	ApprovalID   string `json:"approval_id,omitempty"`   // 审批实例 ID, 获取方式: 1）[获取审批通过数据](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_approval/query) 2）[写入审批结果](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_approval/create) 3）[通知补卡审批发起（补卡情况下）](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_task_remedy/create), 示例值: "6737202939523236113"
	ApprovalType string `json:"approval_type,omitempty"` // 审批类型, leave: 请假, out: 外出, overtime: 加班, trip: 出差, remedy: 补卡, 示例值: "remedy"
	Status       int64  `json:"status,omitempty"`        // 审批状态, `1`: 不通过, `2`: 通过, `4`: 撤销, 注意, 请假、外出、加班、出差只支持传撤销, 补卡支持传不通过、通过和撤销, 示例值: 4
}

// UpdateAttendanceRemedyApprovalResp ...
type UpdateAttendanceRemedyApprovalResp struct {
	ApprovalInfo *UpdateAttendanceRemedyApprovalRespApprovalInfo `json:"approval_info,omitempty"` // 审批信息
}

// UpdateAttendanceRemedyApprovalRespApprovalInfo ...
type UpdateAttendanceRemedyApprovalRespApprovalInfo struct {
	ApprovalID   string `json:"approval_id,omitempty"`   // 审批实例 ID
	ApprovalType string `json:"approval_type,omitempty"` // 审批类型, 可选值有: leave: 请假, overtime: 加班, trip: 出差, out: 外出, remedy: 补卡
	Status       int64  `json:"status,omitempty"`        // 审批状态, 可选值有: 0: 待审批, 1: 未通过, 2: 已通过, 3: 已取消, 4: 已撤回
}

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