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

// CreateCoreHRJobFamily 创建序列。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_family/create
// new doc: https://open.feishu.cn/document/server-docs/corehr-v1/job-management/job_family/create
func (r *CoreHRService) CreateCoreHRJobFamily(ctx context.Context, request *CreateCoreHRJobFamilyReq, options ...MethodOptionFunc) (*CreateCoreHRJobFamilyResp, *Response, error) {
	if r.cli.mock.mockCoreHRCreateCoreHRJobFamily != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] CoreHR#CreateCoreHRJobFamily mock enable")
		return r.cli.mock.mockCoreHRCreateCoreHRJobFamily(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "CoreHR",
		API:                   "CreateCoreHRJobFamily",
		Method:                "POST",
		URL:                   r.cli.openBaseURL + "/open-apis/corehr/v1/job_families",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
	}
	resp := new(createCoreHRJobFamilyResp)

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

// MockCoreHRCreateCoreHRJobFamily mock CoreHRCreateCoreHRJobFamily method
func (r *Mock) MockCoreHRCreateCoreHRJobFamily(f func(ctx context.Context, request *CreateCoreHRJobFamilyReq, options ...MethodOptionFunc) (*CreateCoreHRJobFamilyResp, *Response, error)) {
	r.mockCoreHRCreateCoreHRJobFamily = f
}

// UnMockCoreHRCreateCoreHRJobFamily un-mock CoreHRCreateCoreHRJobFamily method
func (r *Mock) UnMockCoreHRCreateCoreHRJobFamily() {
	r.mockCoreHRCreateCoreHRJobFamily = nil
}

// CreateCoreHRJobFamilyReq ...
type CreateCoreHRJobFamilyReq struct {
	ClientToken    *string                                `query:"client_token" json:"-"`    // 根据client_token是否一致来判断是否为同一请求, 示例值: 12454646
	Name           []*CreateCoreHRJobFamilyReqName        `json:"name,omitempty"`            // 名称
	Active         bool                                   `json:"active,omitempty"`          // 是否启用, 示例值: true
	ParentID       *string                                `json:"parent_id,omitempty"`       // 上级序列 ID, 枚举值及详细信息可通过[批量查询序列]接口查询获得, 示例值: "4698020757495316313"
	EffectiveTime  string                                 `json:"effective_time,omitempty"`  // 生效时间, 示例值: "2020-05-01 00:00:00"
	ExpirationTime *string                                `json:"expiration_time,omitempty"` // 失效时间, 示例值: "2020-05-02 00:00:00"
	Code           *string                                `json:"code,omitempty"`            // 编码, 示例值: "123456"
	CustomFields   []*CreateCoreHRJobFamilyReqCustomField `json:"custom_fields,omitempty"`   // 自定义字段
}

// CreateCoreHRJobFamilyReqCustomField ...
type CreateCoreHRJobFamilyReqCustomField struct {
	FieldName string `json:"field_name,omitempty"` // 字段名, 示例值: "name"
	Value     string `json:"value,omitempty"`      // 字段值, 是json转义后的字符串, 根据元数据定义不同, 字段格式不同(如123, 123.23, "true", [\"id1\", \"id2\"], "2006-01-02 15:04:05"), 示例值: "Sandy"
}

// CreateCoreHRJobFamilyReqName ...
type CreateCoreHRJobFamilyReqName struct {
	Lang  string `json:"lang,omitempty"`  // 名称信息的语言, 示例值: "zh-CN"
	Value string `json:"value,omitempty"` // 名称信息的内容, 示例值: "张三"
}

// CreateCoreHRJobFamilyResp ...
type CreateCoreHRJobFamilyResp struct {
	JobFamily *CreateCoreHRJobFamilyRespJobFamily `json:"job_family,omitempty"` // 创建成功的序列信息
}

// CreateCoreHRJobFamilyRespJobFamily ...
type CreateCoreHRJobFamilyRespJobFamily struct {
	ID             string                                           `json:"id,omitempty"`              // 序列 ID
	Name           []*CreateCoreHRJobFamilyRespJobFamilyName        `json:"name,omitempty"`            // 名称
	Active         bool                                             `json:"active,omitempty"`          // 是否启用
	ParentID       string                                           `json:"parent_id,omitempty"`       // 上级序列 ID, 枚举值及详细信息可通过[批量查询序列]接口查询获得
	EffectiveTime  string                                           `json:"effective_time,omitempty"`  // 生效时间
	ExpirationTime string                                           `json:"expiration_time,omitempty"` // 失效时间
	Code           string                                           `json:"code,omitempty"`            // 编码
	CustomFields   []*CreateCoreHRJobFamilyRespJobFamilyCustomField `json:"custom_fields,omitempty"`   // 自定义字段
}

// CreateCoreHRJobFamilyRespJobFamilyCustomField ...
type CreateCoreHRJobFamilyRespJobFamilyCustomField struct {
	FieldName string `json:"field_name,omitempty"` // 字段名
	Value     string `json:"value,omitempty"`      // 字段值, 是json转义后的字符串, 根据元数据定义不同, 字段格式不同(如123, 123.23, "true", [\"id1\", \"id2\"], "2006-01-02 15:04:05")
}

// CreateCoreHRJobFamilyRespJobFamilyName ...
type CreateCoreHRJobFamilyRespJobFamilyName struct {
	Lang  string `json:"lang,omitempty"`  // 名称信息的语言
	Value string `json:"value,omitempty"` // 名称信息的内容
}

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