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

// BatchUpdateHireEcoAccountCustomField 更新用户在服务商处的身份标示字段（如用户在服务商处的租户 ID）, 此方法只会更新同一 scope 内 key 一致的自定义字段。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/eco_account_custom_field/batch_update
// new doc: https://open.feishu.cn/document/server-docs/hire-v1/ecological-docking/eco_account_custom_field/batch_update
func (r *HireService) BatchUpdateHireEcoAccountCustomField(ctx context.Context, request *BatchUpdateHireEcoAccountCustomFieldReq, options ...MethodOptionFunc) (*BatchUpdateHireEcoAccountCustomFieldResp, *Response, error) {
	if r.cli.mock.mockHireBatchUpdateHireEcoAccountCustomField != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Hire#BatchUpdateHireEcoAccountCustomField mock enable")
		return r.cli.mock.mockHireBatchUpdateHireEcoAccountCustomField(ctx, request, options...)
	}

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

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

// MockHireBatchUpdateHireEcoAccountCustomField mock HireBatchUpdateHireEcoAccountCustomField method
func (r *Mock) MockHireBatchUpdateHireEcoAccountCustomField(f func(ctx context.Context, request *BatchUpdateHireEcoAccountCustomFieldReq, options ...MethodOptionFunc) (*BatchUpdateHireEcoAccountCustomFieldResp, *Response, error)) {
	r.mockHireBatchUpdateHireEcoAccountCustomField = f
}

// UnMockHireBatchUpdateHireEcoAccountCustomField un-mock HireBatchUpdateHireEcoAccountCustomField method
func (r *Mock) UnMockHireBatchUpdateHireEcoAccountCustomField() {
	r.mockHireBatchUpdateHireEcoAccountCustomField = nil
}

// BatchUpdateHireEcoAccountCustomFieldReq ...
type BatchUpdateHireEcoAccountCustomFieldReq struct {
	Scope           int64                                                 `json:"scope,omitempty"`             // 适用范围, 示例值: 1, 可选值有: 1: 背调, 2: 笔试
	CustomFieldList []*BatchUpdateHireEcoAccountCustomFieldReqCustomField `json:"custom_field_list,omitempty"` // 自定义字段列表
}

// BatchUpdateHireEcoAccountCustomFieldReqCustomField ...
type BatchUpdateHireEcoAccountCustomFieldReqCustomField struct {
	Key         string                                                         `json:"key,omitempty"`         // 自定义字段的标识, 同一 scope 内须唯一, 示例值: "org_id"
	Name        *BatchUpdateHireEcoAccountCustomFieldReqCustomFieldName        `json:"name,omitempty"`        // 自定义字段的名称, 用户在添加账号表单看到的控件标题
	IsRequired  bool                                                           `json:"is_required,omitempty"` // 是否必填, 示例值: true
	Description *BatchUpdateHireEcoAccountCustomFieldReqCustomFieldDescription `json:"description,omitempty"` // 自定义字段的描述, 用户在添加账号表单看到的 place holder
}

// BatchUpdateHireEcoAccountCustomFieldReqCustomFieldDescription ...
type BatchUpdateHireEcoAccountCustomFieldReqCustomFieldDescription struct {
	ZhCn *string `json:"zh_cn,omitempty"` // 中文, 示例值: "测试"
	EnUs *string `json:"en_us,omitempty"` // 英文, 示例值: "test"
}

// BatchUpdateHireEcoAccountCustomFieldReqCustomFieldName ...
type BatchUpdateHireEcoAccountCustomFieldReqCustomFieldName struct {
	ZhCn *string `json:"zh_cn,omitempty"` // 中文, 示例值: "测试"
	EnUs *string `json:"en_us,omitempty"` // 英文, 示例值: "test"
}

// BatchUpdateHireEcoAccountCustomFieldResp ...
type BatchUpdateHireEcoAccountCustomFieldResp struct {
}

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