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

// GetCoreHRJob 根据 ID 查询单个职务。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job/get
// new doc: https://open.feishu.cn/document/server-docs/corehr-v1/job-management/job/get
func (r *CoreHRService) GetCoreHRJob(ctx context.Context, request *GetCoreHRJobReq, options ...MethodOptionFunc) (*GetCoreHRJobResp, *Response, error) {
	if r.cli.mock.mockCoreHRGetCoreHRJob != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] CoreHR#GetCoreHRJob mock enable")
		return r.cli.mock.mockCoreHRGetCoreHRJob(ctx, request, options...)
	}

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

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

// MockCoreHRGetCoreHRJob mock CoreHRGetCoreHRJob method
func (r *Mock) MockCoreHRGetCoreHRJob(f func(ctx context.Context, request *GetCoreHRJobReq, options ...MethodOptionFunc) (*GetCoreHRJobResp, *Response, error)) {
	r.mockCoreHRGetCoreHRJob = f
}

// UnMockCoreHRGetCoreHRJob un-mock CoreHRGetCoreHRJob method
func (r *Mock) UnMockCoreHRGetCoreHRJob() {
	r.mockCoreHRGetCoreHRJob = nil
}

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

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

// GetCoreHRJobRespJob ...
type GetCoreHRJobRespJob struct {
	ID                 string                            `json:"id,omitempty"`                    // 职务 ID
	Code               string                            `json:"code,omitempty"`                  // 编码
	Name               []*GetCoreHRJobRespJobName        `json:"name,omitempty"`                  // 名称
	Description        []*GetCoreHRJobRespJobDescription `json:"description,omitempty"`           // 描述
	Active             bool                              `json:"active,omitempty"`                // 是否启用
	JobTitle           []*GetCoreHRJobRespJobJobTitle    `json:"job_title,omitempty"`             // 职务头衔
	JobFamilyIDList    []string                          `json:"job_family_id_list,omitempty"`    // 职务序列 ID 列表, 枚举值及详细信息可通过[批量查询职务序列]接口查询获得
	JobLevelIDList     []string                          `json:"job_level_id_list,omitempty"`     // 职务级别 ID 列表, 枚举值及详细信息可通过[批量查询职务级别]接口查询获得
	WorkingHoursTypeID string                            `json:"working_hours_type_id,omitempty"` // 工时制度 ID, 枚举值及详细信息可通过[批量查询工时制度]接口查询获得
	EffectiveTime      string                            `json:"effective_time,omitempty"`        // 生效时间
	ExpirationTime     string                            `json:"expiration_time,omitempty"`       // 失效时间
	CustomFields       []*GetCoreHRJobRespJobCustomField `json:"custom_fields,omitempty"`         // 自定义字段
}

// GetCoreHRJobRespJobCustomField ...
type GetCoreHRJobRespJobCustomField 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")
}

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

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

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

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