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

// UpdateApplicationAppVisibility 该接口用于更新当前企业内自建应用或已安装的商店应用的可见范围, 包括可用人员与禁用人员。更新后对线上立即生效。
//
// 当通过接口新增用户或部门时, 提前判断对应用户或部门是否已在禁用名单中, 如果已在禁用名单中, 则即便将用户或部门添加到可用名单, 该用户或部门也无法看到该应用, 即禁用名单优先级高于可用名单。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/ucDN3UjL3QzN14yN0cTN
// new doc: https://open.feishu.cn/document/server-docs/application-v6/admin/update-the-availability-of-an-app
//
// Deprecated
func (r *ApplicationService) UpdateApplicationAppVisibility(ctx context.Context, request *UpdateApplicationAppVisibilityReq, options ...MethodOptionFunc) (*UpdateApplicationAppVisibilityResp, *Response, error) {
	if r.cli.mock.mockApplicationUpdateApplicationAppVisibility != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Application#UpdateApplicationAppVisibility mock enable")
		return r.cli.mock.mockApplicationUpdateApplicationAppVisibility(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Application",
		API:                   "UpdateApplicationAppVisibility",
		Method:                "POST",
		URL:                   r.cli.openBaseURL + "/open-apis/application/v3/app/update_visibility",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
	}
	resp := new(updateApplicationAppVisibilityResp)

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

// MockApplicationUpdateApplicationAppVisibility mock ApplicationUpdateApplicationAppVisibility method
func (r *Mock) MockApplicationUpdateApplicationAppVisibility(f func(ctx context.Context, request *UpdateApplicationAppVisibilityReq, options ...MethodOptionFunc) (*UpdateApplicationAppVisibilityResp, *Response, error)) {
	r.mockApplicationUpdateApplicationAppVisibility = f
}

// UnMockApplicationUpdateApplicationAppVisibility un-mock ApplicationUpdateApplicationAppVisibility method
func (r *Mock) UnMockApplicationUpdateApplicationAppVisibility() {
	r.mockApplicationUpdateApplicationAppVisibility = nil
}

// UpdateApplicationAppVisibilityReq ...
type UpdateApplicationAppVisibilityReq struct {
	AppID           string                                      `json:"app_id,omitempty"`             // 目标应用的 ID
	DelUsers        []*UpdateApplicationAppVisibilityReqDelUser `json:"del_users,omitempty"`          // 删除的用户列表, 元素个数不超过 500, 先增加后删除
	AddUsers        []*UpdateApplicationAppVisibilityReqAddUser `json:"add_users,omitempty"`          // 增加的用户列表, 元素个数不超过500, 先增加后删除
	IsVisiableToAll *int64                                      `json:"is_visiable_to_all,omitempty"` // 是否全员可见, 0: 否；1: 是；不填: 继续当前状态不改变
	AddDepartments  []string                                    `json:"add_departments,omitempty"`    // 添加的部门列表, 元素个数不超过 500, 先增加后删除
	DelDepartments  []string                                    `json:"del_departments,omitempty"`    // 删除的部门列表, 元素个数不超过 500, 先增加后删除
}

// UpdateApplicationAppVisibilityReqAddUser ...
type UpdateApplicationAppVisibilityReqAddUser struct {
	OpenID *string `json:"open_id,omitempty"` // 与 user_id 至少给其中之一, user_id 优先于 open_id
	UserID *string `json:"user_id,omitempty"`
}

// UpdateApplicationAppVisibilityReqDelUser ...
type UpdateApplicationAppVisibilityReqDelUser struct {
	OpenID *string `json:"open_id,omitempty"` // 与 user_id 至少给其中之一, user_id 优先于 open_id
	UserID *string `json:"user_id,omitempty"`
}

// UpdateApplicationAppVisibilityResp ...
type UpdateApplicationAppVisibilityResp struct {
}

// updateApplicationAppVisibilityResp ...
type updateApplicationAppVisibilityResp struct {
	Code  int64                               `json:"code,omitempty"` // 返回码, 非 0 表示失败
	Msg   string                              `json:"msg,omitempty"`  // 返回码的描述
	Data  *UpdateApplicationAppVisibilityResp `json:"data,omitempty"` // 返回的业务信息
	Error *ErrorDetail                        `json:"error,omitempty"`
}
