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

// GetCoreHRJobListV2 批量查询职务。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/job/list
func (r *CoreHRService) GetCoreHRJobListV2(ctx context.Context, request *GetCoreHRJobListV2Req, options ...MethodOptionFunc) (*GetCoreHRJobListV2Resp, *Response, error) {
	if r.cli.mock.mockCoreHRGetCoreHRJobListV2 != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] CoreHR#GetCoreHRJobListV2 mock enable")
		return r.cli.mock.mockCoreHRGetCoreHRJobListV2(ctx, request, options...)
	}

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

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

// MockCoreHRGetCoreHRJobListV2 mock CoreHRGetCoreHRJobListV2 method
func (r *Mock) MockCoreHRGetCoreHRJobListV2(f func(ctx context.Context, request *GetCoreHRJobListV2Req, options ...MethodOptionFunc) (*GetCoreHRJobListV2Resp, *Response, error)) {
	r.mockCoreHRGetCoreHRJobListV2 = f
}

// UnMockCoreHRGetCoreHRJobListV2 un-mock CoreHRGetCoreHRJobListV2 method
func (r *Mock) UnMockCoreHRGetCoreHRJobListV2() {
	r.mockCoreHRGetCoreHRJobListV2 = nil
}

// GetCoreHRJobListV2Req ...
type GetCoreHRJobListV2Req struct {
	PageToken     *string `query:"page_token" json:"-"`     // 分页标记, 第一次请求不填, 表示从头开始遍历；分页查询结果还有更多项时会同时返回新的 page_token, 下次遍历可采用该 page_token 获取查询结果, 示例值: 1231231987
	PageSize      int64   `query:"page_size" json:"-"`      // 每页获取记录数量, 最大100, 示例值: 100
	Name          *string `query:"name" json:"-"`           // 名称, 示例值: keyword
	QueryLanguage *string `query:"query_language" json:"-"` // 语言, 示例值: zh
}

// GetCoreHRJobListV2Resp ...
type GetCoreHRJobListV2Resp struct {
	Items     []*GetCoreHRJobListV2RespItem `json:"items,omitempty"`      // 查询的职务信息
	HasMore   bool                          `json:"has_more,omitempty"`   // 是否还有更多项
	PageToken string                        `json:"page_token,omitempty"` // 分页标记, 当 has_more 为 true 时, 会同时返回新的 page_token, 否则不返回 page_token
}

// GetCoreHRJobListV2RespItem ...
type GetCoreHRJobListV2RespItem struct {
	ID                 string                                   `json:"id,omitempty"`                    // 实体在CoreHR内部的唯一键
	Code               string                                   `json:"code,omitempty"`                  // 编码
	Name               []*GetCoreHRJobListV2RespItemName        `json:"name,omitempty"`                  // 名称
	Description        []*GetCoreHRJobListV2RespItemDescription `json:"description,omitempty"`           // 描述
	Active             bool                                     `json:"active,omitempty"`                // 启用
	JobTitle           []*GetCoreHRJobListV2RespItemJobTitle    `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       []*GetCoreHRJobListV2RespItemCustomField `json:"custom_fields,omitempty"`         // 自定义字段
}

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

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

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

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

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