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

// UpdateHireOfferInternStatus 对「实习待入职」状态的实习 Offer 确认入职、放弃入职, 或对「实习已入职」状态的实习 Offer 操作离职。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/offer/intern_offer_status
// new doc: https://open.feishu.cn/document/server-docs/hire-v1/candidate-management/delivery-process-management/offer/intern_offer_status
func (r *HireService) UpdateHireOfferInternStatus(ctx context.Context, request *UpdateHireOfferInternStatusReq, options ...MethodOptionFunc) (*UpdateHireOfferInternStatusResp, *Response, error) {
	if r.cli.mock.mockHireUpdateHireOfferInternStatus != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Hire#UpdateHireOfferInternStatus mock enable")
		return r.cli.mock.mockHireUpdateHireOfferInternStatus(ctx, request, options...)
	}

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

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

// MockHireUpdateHireOfferInternStatus mock HireUpdateHireOfferInternStatus method
func (r *Mock) MockHireUpdateHireOfferInternStatus(f func(ctx context.Context, request *UpdateHireOfferInternStatusReq, options ...MethodOptionFunc) (*UpdateHireOfferInternStatusResp, *Response, error)) {
	r.mockHireUpdateHireOfferInternStatus = f
}

// UnMockHireUpdateHireOfferInternStatus un-mock HireUpdateHireOfferInternStatus method
func (r *Mock) UnMockHireUpdateHireOfferInternStatus() {
	r.mockHireUpdateHireOfferInternStatus = nil
}

// UpdateHireOfferInternStatusReq ...
type UpdateHireOfferInternStatusReq struct {
	OfferID         string                                         `path:"offer_id" json:"-"`          // Offer ID, 示例值: "7016605170635213100"
	Operation       string                                         `json:"operation,omitempty"`        // 更新入/离职状态的操作, 示例值: "confirm_onboarding", 可选值有: confirm_onboarding: 确认入职, cancel_onboarding: 放弃入职, offboard: 操作离职
	OnboardingInfo  *UpdateHireOfferInternStatusReqOnboardingInfo  `json:"onboarding_info,omitempty"`  // 入职表单信息（当 operation 为 confirm_onboarding 时, 该字段必填）
	OffboardingInfo *UpdateHireOfferInternStatusReqOffboardingInfo `json:"offboarding_info,omitempty"` // 离职表单信息（当 operation 为 offboard 时, 该字段必填）
}

// UpdateHireOfferInternStatusReqOffboardingInfo ...
type UpdateHireOfferInternStatusReqOffboardingInfo struct {
	ActualOffboardingDate string  `json:"actual_offboarding_date,omitempty"` // 实际离职日期（实际离职日期需晚于实际入职日期）, 示例值: "2022-03-02"
	Notes                 *string `json:"notes,omitempty"`                   // 备注, 示例值: "主动离职"
}

// UpdateHireOfferInternStatusReqOnboardingInfo ...
type UpdateHireOfferInternStatusReqOnboardingInfo struct {
	ActualOnboardingDate string `json:"actual_onboarding_date,omitempty"` // 实际入职日期, 示例值: "2022-01-01"
}

// UpdateHireOfferInternStatusResp ...
type UpdateHireOfferInternStatusResp struct {
	OfferID         string                                          `json:"offer_id,omitempty"`         // Offer ID
	Operation       string                                          `json:"operation,omitempty"`        // 更新入/离职状态的操作, 可选值有: confirm_onboarding: 确认入职, cancel_onboarding: 放弃入职, offboard: 操作离职
	OnboardingInfo  *UpdateHireOfferInternStatusRespOnboardingInfo  `json:"onboarding_info,omitempty"`  // 入职表单信息（当 operation 为 confirm_onboarding 时, 该字段必填）
	OffboardingInfo *UpdateHireOfferInternStatusRespOffboardingInfo `json:"offboarding_info,omitempty"` // 离职表单信息（当 operation 为 offboard 时, 该字段必填）
}

// UpdateHireOfferInternStatusRespOffboardingInfo ...
type UpdateHireOfferInternStatusRespOffboardingInfo struct {
	ActualOffboardingDate string `json:"actual_offboarding_date,omitempty"` // 实际离职日期（实际离职日期需晚于实际入职日期）
	Notes                 string `json:"notes,omitempty"`                   // 备注
}

// UpdateHireOfferInternStatusRespOnboardingInfo ...
type UpdateHireOfferInternStatusRespOnboardingInfo struct {
	ActualOnboardingDate string `json:"actual_onboarding_date,omitempty"` // 实际入职日期
}

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