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

// GetDrivePublicPermissionOld 该接口用于根据 filetoken 获取云文档的权限设置。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uITM3YjLyEzN24iMxcjN
// new doc: https://open.feishu.cn/document/server-docs/historic-version/docs/drive/permission/get-document-sharing-settings-v2
//
// Deprecated
func (r *DriveService) GetDrivePublicPermissionOld(ctx context.Context, request *GetDrivePublicPermissionOldReq, options ...MethodOptionFunc) (*GetDrivePublicPermissionOldResp, *Response, error) {
	if r.cli.mock.mockDriveGetDrivePublicPermissionOld != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#GetDrivePublicPermissionOld mock enable")
		return r.cli.mock.mockDriveGetDrivePublicPermissionOld(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Drive",
		API:                   "GetDrivePublicPermissionOld",
		Method:                "POST",
		URL:                   r.cli.openBaseURL + "/open-apis/drive/permission/v2/public/",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(getDrivePublicPermissionOldResp)

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

// MockDriveGetDrivePublicPermissionOld mock DriveGetDrivePublicPermissionOld method
func (r *Mock) MockDriveGetDrivePublicPermissionOld(f func(ctx context.Context, request *GetDrivePublicPermissionOldReq, options ...MethodOptionFunc) (*GetDrivePublicPermissionOldResp, *Response, error)) {
	r.mockDriveGetDrivePublicPermissionOld = f
}

// UnMockDriveGetDrivePublicPermissionOld un-mock DriveGetDrivePublicPermissionOld method
func (r *Mock) UnMockDriveGetDrivePublicPermissionOld() {
	r.mockDriveGetDrivePublicPermissionOld = nil
}

// GetDrivePublicPermissionOldReq ...
type GetDrivePublicPermissionOldReq struct {
	Token string `json:"token,omitempty"` // 文件的 token, 获取方式见 [概述](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN#8353e05f)
	Type  string `json:"type,omitempty"`  // 文档类型 "doc", "sheet" or "isv"
}

// GetDrivePublicPermissionOldResp ...
type GetDrivePublicPermissionOldResp struct {
	SecurityEntity    string `json:"security_entity,omitempty"`    // 可创建副本/打印/导出/复制设置: "anyone_can_view" - 所有可访问此文档的用户 "anyone_can_edit" - 有编辑权限的用户
	CommentEntity     string `json:"comment_entity,omitempty"`     // 可评论设置: "anyone_can_view" - 所有可访问此文档的用户 "anyone_can_edit" - 有编辑权限的用户
	ShareEntity       string `json:"share_entity,omitempty"`       // 谁可以添加和管理协作者: "anyone"-所有可阅读或编辑此文档的用户 "same_tenant"-组织内所有可阅读或编辑此文档的用户 "only_me"-只有我可以
	LinkShareEntity   string `json:"link_share_entity,omitempty"`  // 链接共享: "tenant_readable" - 组织内获得链接的人可阅读 "tenant_editable" - 组织内获得链接的人可编辑 "anyone_readable" - 获得链接的任何人可阅读 "anyone_editable" - 获得链接的任何人可编辑
	ExternalAccess    bool   `json:"external_access,omitempty"`    // 是否允许分享到租户外开关
	InviteExternal    bool   `json:"invite_external,omitempty"`    // 非owner是否允许邀请外部人
	PermissionVersion string `json:"permission_version,omitempty"` // 权限版本号
}

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