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

// GetOKRMetricSourceList 获取租户下全部 OKR 指标库（仅限 OKR 企业版使用）。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/okr-v1/metric_source/list
//
// Deprecated
func (r *OKRService) GetOKRMetricSourceList(ctx context.Context, request *GetOKRMetricSourceListReq, options ...MethodOptionFunc) (*GetOKRMetricSourceListResp, *Response, error) {
	if r.cli.mock.mockOKRGetOKRMetricSourceList != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] OKR#GetOKRMetricSourceList mock enable")
		return r.cli.mock.mockOKRGetOKRMetricSourceList(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "OKR",
		API:                   "GetOKRMetricSourceList",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/okr/v1/metric_sources",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(getOKRMetricSourceListResp)

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

// MockOKRGetOKRMetricSourceList mock OKRGetOKRMetricSourceList method
func (r *Mock) MockOKRGetOKRMetricSourceList(f func(ctx context.Context, request *GetOKRMetricSourceListReq, options ...MethodOptionFunc) (*GetOKRMetricSourceListResp, *Response, error)) {
	r.mockOKRGetOKRMetricSourceList = f
}

// UnMockOKRGetOKRMetricSourceList un-mock OKRGetOKRMetricSourceList method
func (r *Mock) UnMockOKRGetOKRMetricSourceList() {
	r.mockOKRGetOKRMetricSourceList = nil
}

// GetOKRMetricSourceListReq ...
type GetOKRMetricSourceListReq struct {
	PageToken *string `query:"page_token" json:"-"` // 页码标识, 获取第一页传空, 每次查询会返回下一页的page_token, 示例值: "6969864184272078374"
	PageSize  *int64  `query:"page_size" json:"-"`  // 每页获取记录数, 示例值: "10"
}

// GetOKRMetricSourceListResp ...
type GetOKRMetricSourceListResp struct {
	Total     int64                             `json:"total,omitempty"`      // 符合条件的记录总数
	HasMore   bool                              `json:"has_more,omitempty"`   // 是否有下一页
	PageToken string                            `json:"page_token,omitempty"` // 下一页页码
	Items     []*GetOKRMetricSourceListRespItem `json:"items,omitempty"`      // 指标库列表
}

// GetOKRMetricSourceListRespItem ...
type GetOKRMetricSourceListRespItem struct {
	MetricSourceID   string                                    `json:"metric_source_id,omitempty"`   // 指标库 id
	MetricSourceName string                                    `json:"metric_source_name,omitempty"` // 指标库名称
	MetricName       string                                    `json:"metric_name,omitempty"`        // 指标名称
	MetricUnit       *GetOKRMetricSourceListRespItemMetricUnit `json:"metric_unit,omitempty"`        // 指标单位
}

// GetOKRMetricSourceListRespItemMetricUnit ...
type GetOKRMetricSourceListRespItemMetricUnit struct {
	ZhCn string `json:"zh_cn,omitempty"` // 指标单位中文
	EnUs string `json:"en_us,omitempty"` // 指标单位英文
	JaJp string `json:"ja_jp,omitempty"` // 指标单位日文
}

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