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

// GetCoreHRJobV2 根据 ID 查询单个职务。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/job/get
func (r *CoreHRService) GetCoreHRJobV2(ctx context.Context, request *GetCoreHRJobV2Req, options ...MethodOptionFunc) (*GetCoreHRJobV2Resp, *Response, error) {
	if r.cli.mock.mockCoreHRGetCoreHRJobV2 != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] CoreHR#GetCoreHRJobV2 mock enable")
		return r.cli.mock.mockCoreHRGetCoreHRJobV2(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "CoreHR",
		API:                   "GetCoreHRJobV2",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/corehr/v2/jobs/:job_id",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
	}
	resp := new(getCoreHRJobV2Resp)

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

// MockCoreHRGetCoreHRJobV2 mock CoreHRGetCoreHRJobV2 method
func (r *Mock) MockCoreHRGetCoreHRJobV2(f func(ctx context.Context, request *GetCoreHRJobV2Req, options ...MethodOptionFunc) (*GetCoreHRJobV2Resp, *Response, error)) {
	r.mockCoreHRGetCoreHRJobV2 = f
}

// UnMockCoreHRGetCoreHRJobV2 un-mock CoreHRGetCoreHRJobV2 method
func (r *Mock) UnMockCoreHRGetCoreHRJobV2() {
	r.mockCoreHRGetCoreHRJobV2 = nil
}

// GetCoreHRJobV2Req ...
type GetCoreHRJobV2Req struct {
	JobID string `path:"job_id" json:"-"` // 职务 ID, 示例值: "151515"
}

// GetCoreHRJobV2Resp ...
type GetCoreHRJobV2Resp struct {
	Job *GetCoreHRJobV2RespJob `json:"job,omitempty"` // 职务信息
}

// GetCoreHRJobV2RespJob ...
type GetCoreHRJobV2RespJob struct {
	ID                 string                              `json:"id,omitempty"`                    // 实体在CoreHR内部的唯一键
	Code               string                              `json:"code,omitempty"`                  // 编码
	Name               []*GetCoreHRJobV2RespJobName        `json:"name,omitempty"`                  // 名称
	Description        []*GetCoreHRJobV2RespJobDescription `json:"description,omitempty"`           // 描述
	Active             bool                                `json:"active,omitempty"`                // 启用
	JobTitle           []*GetCoreHRJobV2RespJobJobTitle    `json:"job_title,omitempty"`             // 职务头衔
	JobFamilyIDList    []string                            `json:"job_family_id_list,omitempty"`    // 序列
	JobLevelIDList     []string                            `json:"job_level_id_list,omitempty"`     // 职级, 字段权限要求: 获取职务中的职级信息
	WorkingHoursTypeID string                              `json:"working_hours_type_id,omitempty"` // 工时制度, 引用WorkingHoursType的ID
	EffectiveTime      string                              `json:"effective_time,omitempty"`        // 生效时间
	ExpirationTime     string                              `json:"expiration_time,omitempty"`       // 失效时间
	CustomFields       []*GetCoreHRJobV2RespJobCustomField `json:"custom_fields,omitempty"`         // 自定义字段
}

// GetCoreHRJobV2RespJobCustomField ...
type GetCoreHRJobV2RespJobCustomField 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])
}

// GetCoreHRJobV2RespJobDescription ...
type GetCoreHRJobV2RespJobDescription struct {
	Lang  string `json:"lang,omitempty"`  // 语言
	Value string `json:"value,omitempty"` // 内容
}

// GetCoreHRJobV2RespJobJobTitle ...
type GetCoreHRJobV2RespJobJobTitle struct {
	Lang  string `json:"lang,omitempty"`  // 语言
	Value string `json:"value,omitempty"` // 内容
}

// GetCoreHRJobV2RespJobName ...
type GetCoreHRJobV2RespJobName struct {
	Lang  string `json:"lang,omitempty"`  // 语言
	Value string `json:"value,omitempty"` // 内容
}

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