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

// GetCoreHRNationalIDType 根据 ID 查询单个国家证件类型。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/national_id_type/get
// new doc: https://open.feishu.cn/document/server-docs/corehr-v1/basic-infomation/national_id_type/get
func (r *CoreHRService) GetCoreHRNationalIDType(ctx context.Context, request *GetCoreHRNationalIDTypeReq, options ...MethodOptionFunc) (*GetCoreHRNationalIDTypeResp, *Response, error) {
	if r.cli.mock.mockCoreHRGetCoreHRNationalIDType != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] CoreHR#GetCoreHRNationalIDType mock enable")
		return r.cli.mock.mockCoreHRGetCoreHRNationalIDType(ctx, request, options...)
	}

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

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

// MockCoreHRGetCoreHRNationalIDType mock CoreHRGetCoreHRNationalIDType method
func (r *Mock) MockCoreHRGetCoreHRNationalIDType(f func(ctx context.Context, request *GetCoreHRNationalIDTypeReq, options ...MethodOptionFunc) (*GetCoreHRNationalIDTypeResp, *Response, error)) {
	r.mockCoreHRGetCoreHRNationalIDType = f
}

// UnMockCoreHRGetCoreHRNationalIDType un-mock CoreHRGetCoreHRNationalIDType method
func (r *Mock) UnMockCoreHRGetCoreHRNationalIDType() {
	r.mockCoreHRGetCoreHRNationalIDType = nil
}

// GetCoreHRNationalIDTypeReq ...
type GetCoreHRNationalIDTypeReq struct {
	NationalIDTypeID string `path:"national_id_type_id" json:"-"` // 证件类型 ID, 示例值: "121515"
}

// GetCoreHRNationalIDTypeResp ...
type GetCoreHRNationalIDTypeResp struct {
	NationalIDType *GetCoreHRNationalIDTypeRespNationalIDType `json:"national_id_type,omitempty"` // 国家证件类型信息
}

// GetCoreHRNationalIDTypeRespNationalIDType ...
type GetCoreHRNationalIDTypeRespNationalIDType struct {
	ID                        string                                                                `json:"id,omitempty"`                          // 证件类型 ID
	CountryRegionID           string                                                                `json:"country_region_id,omitempty"`           // 国家 / 地区
	Name                      []*GetCoreHRNationalIDTypeRespNationalIDTypeName                      `json:"name,omitempty"`                        // 名称
	Active                    bool                                                                  `json:"active,omitempty"`                      // 是否启用
	ValidationRule            string                                                                `json:"validation_rule,omitempty"`             // 校验规则
	ValidationRuleDescription []*GetCoreHRNationalIDTypeRespNationalIDTypeValidationRuleDescription `json:"validation_rule_description,omitempty"` // 校验规则描述
	Code                      string                                                                `json:"code,omitempty"`                        // 编码
	IdentificationType        *GetCoreHRNationalIDTypeRespNationalIDTypeIdentificationType          `json:"identification_type,omitempty"`         // 证件类型
	CustomFields              []*GetCoreHRNationalIDTypeRespNationalIDTypeCustomField               `json:"custom_fields,omitempty"`               // 自定义字段
}

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

// GetCoreHRNationalIDTypeRespNationalIDTypeIdentificationType ...
type GetCoreHRNationalIDTypeRespNationalIDTypeIdentificationType struct {
	EnumName string                                                                `json:"enum_name,omitempty"` // 枚举值
	Display  []*GetCoreHRNationalIDTypeRespNationalIDTypeIdentificationTypeDisplay `json:"display,omitempty"`   // 枚举多语展示
}

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

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

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

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