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

// CopyBitableDashboard 该接口用于根据现有仪表盘复制出新的仪表盘
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-dashboard/copy
// new doc: https://open.feishu.cn/document/server-docs/docs/bitable-v1/app-dashboard/copy
func (r *BitableService) CopyBitableDashboard(ctx context.Context, request *CopyBitableDashboardReq, options ...MethodOptionFunc) (*CopyBitableDashboardResp, *Response, error) {
	if r.cli.mock.mockBitableCopyBitableDashboard != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Bitable#CopyBitableDashboard mock enable")
		return r.cli.mock.mockBitableCopyBitableDashboard(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Bitable",
		API:                   "CopyBitableDashboard",
		Method:                "POST",
		URL:                   r.cli.openBaseURL + "/open-apis/bitable/v1/apps/:app_token/dashboards/:block_id/copy",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(copyBitableDashboardResp)

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

// MockBitableCopyBitableDashboard mock BitableCopyBitableDashboard method
func (r *Mock) MockBitableCopyBitableDashboard(f func(ctx context.Context, request *CopyBitableDashboardReq, options ...MethodOptionFunc) (*CopyBitableDashboardResp, *Response, error)) {
	r.mockBitableCopyBitableDashboard = f
}

// UnMockBitableCopyBitableDashboard un-mock BitableCopyBitableDashboard method
func (r *Mock) UnMockBitableCopyBitableDashboard() {
	r.mockBitableCopyBitableDashboard = nil
}

// CopyBitableDashboardReq ...
type CopyBitableDashboardReq struct {
	AppToken string `path:"app_token" json:"-"` // 多维表格 token, 示例值: "basbcldP5xZeskcHDFZQfeToydb"
	BlockID  string `path:"block_id" json:"-"`  // 多维表格 block_id, 示例值: "blkEsvEEaNllY2UV"
	Name     string `json:"name,omitempty"`     // 仪表盘名称, 示例值: "Dashboard"
}

// CopyBitableDashboardResp ...
type CopyBitableDashboardResp struct {
	BlockID string `json:"block_id,omitempty"` // 多维表格 block_id
	Name    string `json:"name,omitempty"`     // block 名称
}

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