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

// GetCoreHRSubregionList 批量查询城市/区域信息。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/subregion/list
// new doc: https://open.feishu.cn/document/server-docs/corehr-v1/basic-infomation/location_data/list-3
//
// Deprecated
func (r *CoreHRService) GetCoreHRSubregionList(ctx context.Context, request *GetCoreHRSubregionListReq, options ...MethodOptionFunc) (*GetCoreHRSubregionListResp, *Response, error) {
	if r.cli.mock.mockCoreHRGetCoreHRSubregionList != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] CoreHR#GetCoreHRSubregionList mock enable")
		return r.cli.mock.mockCoreHRGetCoreHRSubregionList(ctx, request, options...)
	}

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

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

// MockCoreHRGetCoreHRSubregionList mock CoreHRGetCoreHRSubregionList method
func (r *Mock) MockCoreHRGetCoreHRSubregionList(f func(ctx context.Context, request *GetCoreHRSubregionListReq, options ...MethodOptionFunc) (*GetCoreHRSubregionListResp, *Response, error)) {
	r.mockCoreHRGetCoreHRSubregionList = f
}

// UnMockCoreHRGetCoreHRSubregionList un-mock CoreHRGetCoreHRSubregionList method
func (r *Mock) UnMockCoreHRGetCoreHRSubregionList() {
	r.mockCoreHRGetCoreHRSubregionList = nil
}

// GetCoreHRSubregionListReq ...
type GetCoreHRSubregionListReq struct {
	PageToken     *string `query:"page_token" json:"-"`     // 分页标记, 第一次请求不填, 表示从头开始遍历；分页查询结果还有更多项时会同时返回新的 page_token, 下次遍历可采用该 page_token 获取查询结果, 示例值: 1231231987
	PageSize      int64   `query:"page_size" json:"-"`      // 分页大小, 示例值: 100
	SubdivisionID *string `query:"subdivision_id" json:"-"` // 省份/行政区id, 填写后只查询该省份/行政区下的城市/区域, 示例值: 100
}

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

// GetCoreHRSubregionListRespItem ...
type GetCoreHRSubregionListRespItem struct {
	ID                  string                                `json:"id,omitempty"`                    // 城市/区域id
	Name                []*GetCoreHRSubregionListRespItemName `json:"name,omitempty"`                  // 城市/区域名称
	SubdivisionID       string                                `json:"subdivision_id,omitempty"`        // 所属省份/行政区id, 详细信息可通过[查询省份/行政区信息]接口查询获得
	SuperiorSubregionID string                                `json:"superior_subregion_id,omitempty"` // 上级城市/区域区id
}

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

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