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

// CreateHireEcoAccountCustomField 定制用户在服务商处的身份标示字段（如用户在服务商处的租户 ID）。用户在飞书招聘后台添加帐号后, 系统会推送「帐号绑定」事件给开发者, 事件将携带用户填写的自定义字段信息, 开发者可根据此信息识别飞书招聘用户在服务商处的身份信息, 完成飞书招聘用户和服务商帐号的绑定, 并以此来推送对应的套餐或试卷列表等。 可多次推送, 多次推送为覆盖逻辑。
//
// 该接口调用时机有两种情况:
// - 当用户在飞书管理后台首次安装服务商应用时。服务商将收到「首次安装事件」, 服务商需响应处理「首次安装应用」事件。调用此接口推送账号表单。
// - 当用户在飞书管理后台启用应用时。 服务商将收到「应用启用」事件, 服务商需响应处理「应用启用」事件。调用此接口推送账号表单。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/eco_account_custom_field/create
// new doc: https://open.feishu.cn/document/server-docs/hire-v1/ecological-docking/eco_account_custom_field/create
func (r *HireService) CreateHireEcoAccountCustomField(ctx context.Context, request *CreateHireEcoAccountCustomFieldReq, options ...MethodOptionFunc) (*CreateHireEcoAccountCustomFieldResp, *Response, error) {
	if r.cli.mock.mockHireCreateHireEcoAccountCustomField != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Hire#CreateHireEcoAccountCustomField mock enable")
		return r.cli.mock.mockHireCreateHireEcoAccountCustomField(ctx, request, options...)
	}

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

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

// MockHireCreateHireEcoAccountCustomField mock HireCreateHireEcoAccountCustomField method
func (r *Mock) MockHireCreateHireEcoAccountCustomField(f func(ctx context.Context, request *CreateHireEcoAccountCustomFieldReq, options ...MethodOptionFunc) (*CreateHireEcoAccountCustomFieldResp, *Response, error)) {
	r.mockHireCreateHireEcoAccountCustomField = f
}

// UnMockHireCreateHireEcoAccountCustomField un-mock HireCreateHireEcoAccountCustomField method
func (r *Mock) UnMockHireCreateHireEcoAccountCustomField() {
	r.mockHireCreateHireEcoAccountCustomField = nil
}

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

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

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

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

// CreateHireEcoAccountCustomFieldResp ...
type CreateHireEcoAccountCustomFieldResp struct {
}

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