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

// GetCoreHRCountryRegion 查询单条国家/地区信息。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/country_region/get
// new doc: https://open.feishu.cn/document/server-docs/corehr-v1/basic-infomation/location_data/get
//
// Deprecated
func (r *CoreHRService) GetCoreHRCountryRegion(ctx context.Context, request *GetCoreHRCountryRegionReq, options ...MethodOptionFunc) (*GetCoreHRCountryRegionResp, *Response, error) {
	if r.cli.mock.mockCoreHRGetCoreHRCountryRegion != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] CoreHR#GetCoreHRCountryRegion mock enable")
		return r.cli.mock.mockCoreHRGetCoreHRCountryRegion(ctx, request, options...)
	}

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

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

// MockCoreHRGetCoreHRCountryRegion mock CoreHRGetCoreHRCountryRegion method
func (r *Mock) MockCoreHRGetCoreHRCountryRegion(f func(ctx context.Context, request *GetCoreHRCountryRegionReq, options ...MethodOptionFunc) (*GetCoreHRCountryRegionResp, *Response, error)) {
	r.mockCoreHRGetCoreHRCountryRegion = f
}

// UnMockCoreHRGetCoreHRCountryRegion un-mock CoreHRGetCoreHRCountryRegion method
func (r *Mock) UnMockCoreHRGetCoreHRCountryRegion() {
	r.mockCoreHRGetCoreHRCountryRegion = nil
}

// GetCoreHRCountryRegionReq ...
type GetCoreHRCountryRegionReq struct {
	CountryRegionID string `path:"country_region_id" json:"-"` // 国家/地区 ID, 示例值: "67489937334909845"
}

// GetCoreHRCountryRegionResp ...
type GetCoreHRCountryRegionResp struct {
	CountryRegion *GetCoreHRCountryRegionRespCountryRegion `json:"country_region,omitempty"` // 国家/地区信息
}

// GetCoreHRCountryRegionRespCountryRegion ...
type GetCoreHRCountryRegionRespCountryRegion struct {
	ID         string                                         `json:"id,omitempty"`           // 国家/地区id
	Name       []*GetCoreHRCountryRegionRespCountryRegionName `json:"name,omitempty"`         // 国家/地区名称
	Alpha3Code string                                         `json:"alpha_3_code,omitempty"` // 国家地区三字码
	Alpha2Code string                                         `json:"alpha_2_code,omitempty"` // 国家地区二字码
}

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

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