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

// GetOKRMetricSourceTableList 获取指定指标库下有哪些指标表（仅限 OKR 企业版使用）。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/okr-v1/metric_source-table/list
//
// Deprecated
func (r *OKRService) GetOKRMetricSourceTableList(ctx context.Context, request *GetOKRMetricSourceTableListReq, options ...MethodOptionFunc) (*GetOKRMetricSourceTableListResp, *Response, error) {
	if r.cli.mock.mockOKRGetOKRMetricSourceTableList != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] OKR#GetOKRMetricSourceTableList mock enable")
		return r.cli.mock.mockOKRGetOKRMetricSourceTableList(ctx, request, options...)
	}

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

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

// MockOKRGetOKRMetricSourceTableList mock OKRGetOKRMetricSourceTableList method
func (r *Mock) MockOKRGetOKRMetricSourceTableList(f func(ctx context.Context, request *GetOKRMetricSourceTableListReq, options ...MethodOptionFunc) (*GetOKRMetricSourceTableListResp, *Response, error)) {
	r.mockOKRGetOKRMetricSourceTableList = f
}

// UnMockOKRGetOKRMetricSourceTableList un-mock OKRGetOKRMetricSourceTableList method
func (r *Mock) UnMockOKRGetOKRMetricSourceTableList() {
	r.mockOKRGetOKRMetricSourceTableList = nil
}

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

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

// GetOKRMetricSourceTableListRespItem ...
type GetOKRMetricSourceTableListRespItem struct {
	MetricTableID   string `json:"metric_table_id,omitempty"`   // 指标表 id
	MetricTableName string `json:"metric_table_name,omitempty"` // 指标表名称
	PeriodID        string `json:"period_id,omitempty"`         // okr周期
}

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