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

// GetSheetProtectedDimension 该接口用于根据保护范围ID查询详细的保护行列信息, 最多支持同时查询5个ID。
//
// - 仅支持获取保护行或保护列, 暂不支持获取保护单元格
// - 不支持获取包含多个区域的保护范围
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uQTM5YjL0ETO24CNxkjN
// new doc: https://open.feishu.cn/document/server-docs/docs/sheets-v3/protect-range/retrieve-protection-scopes
func (r *DriveService) GetSheetProtectedDimension(ctx context.Context, request *GetSheetProtectedDimensionReq, options ...MethodOptionFunc) (*GetSheetProtectedDimensionResp, *Response, error) {
	if r.cli.mock.mockDriveGetSheetProtectedDimension != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#GetSheetProtectedDimension mock enable")
		return r.cli.mock.mockDriveGetSheetProtectedDimension(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Drive",
		API:                   "GetSheetProtectedDimension",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/sheets/v2/spreadsheets/:spreadsheetToken/protected_range_batch_get",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(getSheetProtectedDimensionResp)

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

// MockDriveGetSheetProtectedDimension mock DriveGetSheetProtectedDimension method
func (r *Mock) MockDriveGetSheetProtectedDimension(f func(ctx context.Context, request *GetSheetProtectedDimensionReq, options ...MethodOptionFunc) (*GetSheetProtectedDimensionResp, *Response, error)) {
	r.mockDriveGetSheetProtectedDimension = f
}

// UnMockDriveGetSheetProtectedDimension un-mock DriveGetSheetProtectedDimension method
func (r *Mock) UnMockDriveGetSheetProtectedDimension() {
	r.mockDriveGetSheetProtectedDimension = nil
}

// GetSheetProtectedDimensionReq ...
type GetSheetProtectedDimensionReq struct {
	SpreadSheetToken string   `path:"spreadsheetToken" json:"-"`         // spreadsheet 的 token, 获取方式见[在线表格开发指南](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)
	ProtectIDs       []string `query:"protectIds" join_sep:"," json:"-"` // 保护范围ID, 可以通过[获取表格元数据](https://open.feishu.cn/document/ukTMukTMukTM/uETMzUjLxEzM14SMxMTN)接口获取, 多个ID用逗号分隔, 如xxxID1, xxxID2
	MemberType       *string  `query:"memberType" json:"-"`              // 返回的用户类型, 可选userId, openId, unionId, 默认使用userId
}

// GetSheetProtectedDimensionResp ...
type GetSheetProtectedDimensionResp struct {
	ProtectedRanges *GetSheetProtectedDimensionRespProtectedRanges `json:"protectedRanges,omitempty"` // 保护范围
}

// GetSheetProtectedDimensionRespProtectedRanges ...
type GetSheetProtectedDimensionRespProtectedRanges struct {
	ProtectID string                                                  `json:"protectId,omitempty"` // 保护范围ID
	Dimension *GetSheetProtectedDimensionRespProtectedRangesDimension `json:"dimension,omitempty"` // 保护范围, 如果为空, 则为保护子表
	SheetID   string                                                  `json:"sheetId,omitempty"`   // sheet的id
	LockInfo  string                                                  `json:"lockInfo,omitempty"`  // 保护说明
	Editors   *GetSheetProtectedDimensionRespProtectedRangesEditors   `json:"editors,omitempty"`   // 用户信息
}

// GetSheetProtectedDimensionRespProtectedRangesDimension ...
type GetSheetProtectedDimensionRespProtectedRangesDimension struct {
	SheetID        string `json:"sheetId,omitempty"`        // sheet 的 id
	StartIndex     int64  `json:"startIndex,omitempty"`     // 保护行列起始下标, 下标从1开始
	EndIndex       int64  `json:"endIndex,omitempty"`       // 保护行列终止下标, 下标从1开始
	MajorDimension string `json:"majorDimension,omitempty"` // 保护范围的维度, COLUMNS为保护列, ROWS为保护行
}

// GetSheetProtectedDimensionRespProtectedRangesEditors ...
type GetSheetProtectedDimensionRespProtectedRangesEditors struct {
	Users []*GetSheetProtectedDimensionRespProtectedRangesEditorsUser `json:"users,omitempty"` // 用户信息列表
}

// GetSheetProtectedDimensionRespProtectedRangesEditorsUser ...
type GetSheetProtectedDimensionRespProtectedRangesEditorsUser struct {
	MemberType string `json:"memberType,omitempty"` // 用户类型
	MemberID   string `json:"memberId,omitempty"`   // 用户ID
}

// getSheetProtectedDimensionResp ...
type getSheetProtectedDimensionResp struct {
	Code int64                           `json:"code,omitempty"`
	Msg  string                          `json:"msg,omitempty"`
	Data *GetSheetProtectedDimensionResp `json:"data,omitempty"`
}
