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

// UpdateSheetProtectedDimension 该接口用于根据保护范围ID修改保护范围, 单次最多支持同时修改10个ID。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uUTM5YjL1ETO24SNxkjN
// new doc: https://open.feishu.cn/document/server-docs/docs/sheets-v3/protect-range/modify-protection-scopes
func (r *DriveService) UpdateSheetProtectedDimension(ctx context.Context, request *UpdateSheetProtectedDimensionReq, options ...MethodOptionFunc) (*UpdateSheetProtectedDimensionResp, *Response, error) {
	if r.cli.mock.mockDriveUpdateSheetProtectedDimension != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#UpdateSheetProtectedDimension mock enable")
		return r.cli.mock.mockDriveUpdateSheetProtectedDimension(ctx, request, options...)
	}

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

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

// MockDriveUpdateSheetProtectedDimension mock DriveUpdateSheetProtectedDimension method
func (r *Mock) MockDriveUpdateSheetProtectedDimension(f func(ctx context.Context, request *UpdateSheetProtectedDimensionReq, options ...MethodOptionFunc) (*UpdateSheetProtectedDimensionResp, *Response, error)) {
	r.mockDriveUpdateSheetProtectedDimension = f
}

// UnMockDriveUpdateSheetProtectedDimension un-mock DriveUpdateSheetProtectedDimension method
func (r *Mock) UnMockDriveUpdateSheetProtectedDimension() {
	r.mockDriveUpdateSheetProtectedDimension = nil
}

// UpdateSheetProtectedDimensionReq ...
type UpdateSheetProtectedDimensionReq struct {
	SpreadSheetToken string                                    `path:"spreadsheetToken" json:"-"` // sheet 的 token, 获取方式见[在线表格开发指南](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)
	Requests         *UpdateSheetProtectedDimensionReqRequests `json:"requests,omitempty"`        // 请求
}

// UpdateSheetProtectedDimensionReqRequests ...
type UpdateSheetProtectedDimensionReqRequests struct {
	ProtectID string                                             `json:"protectId,omitempty"` // 保护范围ID, 可以通过[获取表格元数据](https://open.feishu.cn/document/ukTMukTMukTM/uETMzUjLxEzM14SMxMTN) 接口获取
	Dimension *UpdateSheetProtectedDimensionReqRequestsDimension `json:"dimension,omitempty"` // 行列保护信息
	Editors   []*UpdateSheetProtectedDimensionReqRequestsEditor  `json:"editors,omitempty"`   // 可编辑保护范围的用户
	LockInfo  *string                                            `json:"lockInfo,omitempty"`  // 保护说明
}

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

// UpdateSheetProtectedDimensionReqRequestsEditor ...
type UpdateSheetProtectedDimensionReqRequestsEditor struct {
	AddEditors []*UpdateSheetProtectedDimensionReqRequestsEditorAddEditor `json:"addEditors,omitempty"` // 需要增加的用户的列表, 用户需要有文档的编辑权限
	DelEditors []*UpdateSheetProtectedDimensionReqRequestsEditorDelEditor `json:"delEditors,omitempty"` // 需要删除的用户的列表
}

// UpdateSheetProtectedDimensionReqRequestsEditorAddEditor ...
type UpdateSheetProtectedDimensionReqRequestsEditorAddEditor struct {
	MemberType string `json:"memberType,omitempty"` // 用户类型, 支持userId, openId, unionId
	MemberID   string `json:"memberId,omitempty"`   // 用户类型对应的用户ID
}

// UpdateSheetProtectedDimensionReqRequestsEditorDelEditor ...
type UpdateSheetProtectedDimensionReqRequestsEditorDelEditor struct {
	MemberType string `json:"memberType,omitempty"` // 用户类型, 支持userId, openId, unionId
	MemberID   string `json:"memberId,omitempty"`   // 用户类型对应的用户ID
}

// UpdateSheetProtectedDimensionResp ...
type UpdateSheetProtectedDimensionResp struct {
	Replies []*UpdateSheetProtectedDimensionRespReply `json:"replies,omitempty"` // 响应
}

// UpdateSheetProtectedDimensionRespReply ...
type UpdateSheetProtectedDimensionRespReply struct {
	SheetID   string                                           `json:"sheetId,omitempty"`   // sheet的id
	Dimension *UpdateSheetProtectedDimensionRespReplyDimension `json:"dimension,omitempty"` // 成功修改的保护行列信息
	Editors   []*UpdateSheetProtectedDimensionRespReplyEditor  `json:"editors,omitempty"`   // 可编辑保护范围的用户
	LockInfo  string                                           `json:"lockInfo,omitempty"`  // 成功修改的保护说明
}

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

// UpdateSheetProtectedDimensionRespReplyEditor ...
type UpdateSheetProtectedDimensionRespReplyEditor struct {
	AddEditors []*UpdateSheetProtectedDimensionRespReplyEditorAddEditor `json:"addEditors,omitempty"` // 成功增加的用户的列表
	DelEditors []*UpdateSheetProtectedDimensionRespReplyEditorDelEditor `json:"delEditors,omitempty"` // 成功删除的用户的列表
}

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

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

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