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

// UpdateHireOfferStatus 通过 Offer ID 更新候选人 Offer 的状态。
//
// - 更新 Offer 审批状态, 需要在系统内「设置 - Offer 设置 - Offer 规则设置」开启「通过 OA 系统创建和审批 Offer」。如当前 Offer 已通过飞书招聘发起过审批, 则不可通过此接口更新 Offer 审批状态
// - 更新 Offer 发送和接受状态, 需要在系统内「设置 - Offer 设置 - Offer 规则设置」开启「通过 OA 系统发送 Offer」；仅支持投递阶段在「待入职」之前更新；如当前 Offer 已通过飞书招聘发给过候选人, 则不可通过此接口更新 Offer 发送和接收状态
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/offer/offer_status
// new doc: https://open.feishu.cn/document/server-docs/hire-v1/candidate-management/delivery-process-management/offer/offer_status
func (r *HireService) UpdateHireOfferStatus(ctx context.Context, request *UpdateHireOfferStatusReq, options ...MethodOptionFunc) (*UpdateHireOfferStatusResp, *Response, error) {
	if r.cli.mock.mockHireUpdateHireOfferStatus != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Hire#UpdateHireOfferStatus mock enable")
		return r.cli.mock.mockHireUpdateHireOfferStatus(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Hire",
		API:                   "UpdateHireOfferStatus",
		Method:                "PATCH",
		URL:                   r.cli.openBaseURL + "/open-apis/hire/v1/offers/:offer_id/offer_status",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
	}
	resp := new(updateHireOfferStatusResp)

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

// MockHireUpdateHireOfferStatus mock HireUpdateHireOfferStatus method
func (r *Mock) MockHireUpdateHireOfferStatus(f func(ctx context.Context, request *UpdateHireOfferStatusReq, options ...MethodOptionFunc) (*UpdateHireOfferStatusResp, *Response, error)) {
	r.mockHireUpdateHireOfferStatus = f
}

// UnMockHireUpdateHireOfferStatus un-mock HireUpdateHireOfferStatus method
func (r *Mock) UnMockHireUpdateHireOfferStatus() {
	r.mockHireUpdateHireOfferStatus = nil
}

// UpdateHireOfferStatusReq ...
type UpdateHireOfferStatusReq struct {
	OfferID                 string   `path:"offer_id" json:"-"`                    // offer ID, 示例值: "6930815272790114324"
	OfferStatus             int64    `json:"offer_status,omitempty"`               // offer状态, 示例值: 6, 可选值有: 2: 审批中, 3: 审批已撤回, 4: 审批通过, 5: 审批不通过, 6: Offer已发出, 7: 候选人已接收, 8: 候选人已拒绝, 9: Offer 已失效
	ExpirationDate          *string  `json:"expiration_date,omitempty"`            // offer 失效时间, 当反馈状态是「offer已发出」时为必填项, 示例值: "2023-01-01"
	TerminationReasonIDList []string `json:"termination_reason_id_list,omitempty"` // 终止原因列表, 当反馈状态是「候选人已拒绝」时为必填项；最多传入50个, 示例值: ["6891560630172518670"]
	TerminationReasonNote   *string  `json:"termination_reason_note,omitempty"`    // 终止备注, 示例值: "不符合期望"
}

// UpdateHireOfferStatusResp ...
type UpdateHireOfferStatusResp struct {
}

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