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

// QueryCoreHRJobGrade 查询职等的详细信息。
//
// doc: https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/job_grade/query
func (r *CoreHRService) QueryCoreHRJobGrade(ctx context.Context, request *QueryCoreHRJobGradeReq, options ...MethodOptionFunc) (*QueryCoreHRJobGradeResp, *Response, error) {
	if r.cli.mock.mockCoreHRQueryCoreHRJobGrade != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] CoreHR#QueryCoreHRJobGrade mock enable")
		return r.cli.mock.mockCoreHRQueryCoreHRJobGrade(ctx, request, options...)
	}

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

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

// MockCoreHRQueryCoreHRJobGrade mock CoreHRQueryCoreHRJobGrade method
func (r *Mock) MockCoreHRQueryCoreHRJobGrade(f func(ctx context.Context, request *QueryCoreHRJobGradeReq, options ...MethodOptionFunc) (*QueryCoreHRJobGradeResp, *Response, error)) {
	r.mockCoreHRQueryCoreHRJobGrade = f
}

// UnMockCoreHRQueryCoreHRJobGrade un-mock CoreHRQueryCoreHRJobGrade method
func (r *Mock) UnMockCoreHRQueryCoreHRJobGrade() {
	r.mockCoreHRQueryCoreHRJobGrade = nil
}

// QueryCoreHRJobGradeReq ...
type QueryCoreHRJobGradeReq struct {
	PageSize  int64    `query:"page_size" json:"-"`  // 分页大小, 最大 100, 示例值: 100, 取值范围: `1` ～ `100`
	PageToken *string  `query:"page_token" json:"-"` // 分页标记, 第一次请求不填, 表示从头开始遍历；分页查询结果还有更多项时会同时返回新的 page_token, 下次遍历可采用该 page_token 获取查询结果, 示例值: 6891251722631890445
	IDs       []string `json:"ids,omitempty"`        // 职等ID列表, 不填写则返回全部列表, 示例值: ["7140964208476371111"], 长度范围: `0` ～ `100`
	Codes     []string `json:"codes,omitempty"`      // 职等code列表, 不填写则返回全部列表, 示例值: ["714096420847637222"], 长度范围: `0` ～ `100`
	Active    *bool    `json:"active,omitempty"`     // 是否启用, 不填写则返回全部列表, 示例值: true
}

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

// QueryCoreHRJobGradeRespItem ...
type QueryCoreHRJobGradeRespItem struct {
	JobGradeID   string                                    `json:"job_grade_id,omitempty"` // 职等 ID
	GradeOrder   int64                                     `json:"grade_order,omitempty"`  // 职等数值, 数字越大代表职等越高
	Code         string                                    `json:"code,omitempty"`         // 编码
	Names        []*QueryCoreHRJobGradeRespItemName        `json:"names,omitempty"`        // 名称
	Descriptions []*QueryCoreHRJobGradeRespItemDescription `json:"descriptions,omitempty"` // 描述
	Active       bool                                      `json:"active,omitempty"`       // 是否启用
}

// QueryCoreHRJobGradeRespItemDescription ...
type QueryCoreHRJobGradeRespItemDescription struct {
	Lang  string `json:"lang,omitempty"`  // 语言, 支持中文和英文。中文用 zh-CN；英文用 en-US。
	Value string `json:"value,omitempty"` // 内容
}

// QueryCoreHRJobGradeRespItemName ...
type QueryCoreHRJobGradeRespItemName struct {
	Lang  string `json:"lang,omitempty"`  // 语言, 支持中文和英文。中文用 zh-CN；英文用 en-US。
	Value string `json:"value,omitempty"` // 内容
}

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