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

// GetApplicationUserAdminScope 该接口用于获取应用管理员的管理范围, 即该应用管理员能够管理哪些部门。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uMzN3QjLzczN04yM3cDN
// new doc: https://open.feishu.cn/document/server-docs/application-v6/admin/obtain-an-app-admin’s-management-permissions
func (r *ApplicationService) GetApplicationUserAdminScope(ctx context.Context, request *GetApplicationUserAdminScopeReq, options ...MethodOptionFunc) (*GetApplicationUserAdminScopeResp, *Response, error) {
	if r.cli.mock.mockApplicationGetApplicationUserAdminScope != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Application#GetApplicationUserAdminScope mock enable")
		return r.cli.mock.mockApplicationGetApplicationUserAdminScope(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Application",
		API:                   "GetApplicationUserAdminScope",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/contact/v1/user/admin_scope/get",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
	}
	resp := new(getApplicationUserAdminScopeResp)

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

// MockApplicationGetApplicationUserAdminScope mock ApplicationGetApplicationUserAdminScope method
func (r *Mock) MockApplicationGetApplicationUserAdminScope(f func(ctx context.Context, request *GetApplicationUserAdminScopeReq, options ...MethodOptionFunc) (*GetApplicationUserAdminScopeResp, *Response, error)) {
	r.mockApplicationGetApplicationUserAdminScope = f
}

// UnMockApplicationGetApplicationUserAdminScope un-mock ApplicationGetApplicationUserAdminScope method
func (r *Mock) UnMockApplicationGetApplicationUserAdminScope() {
	r.mockApplicationGetApplicationUserAdminScope = nil
}

// GetApplicationUserAdminScopeReq ...
type GetApplicationUserAdminScopeReq struct {
	EmployeeID string `query:"employee_id" json:"-"` // 支持通过 open_id 或者 employee_id 查询, 不支持混合两种 ID 进行查询, 其中 employee_id 同通讯录 v3 版本中的 user_id
	OpenID     string `query:"open_id" json:"-"`     // 支持通过 open_id 或者 employee_id 查询, 不支持混合两种 ID 进行查询, 其中 employee_id 同通讯录 v3 版本中的 user_id
}

// GetApplicationUserAdminScopeResp ...
type GetApplicationUserAdminScopeResp struct {
	IsAll          bool     `json:"is_all,omitempty"`          // 是否管理所有部门
	DepartmentList []string `json:"department_list,omitempty"` // 管理的部门列表, 当 is_all 为 true 时, 不返回该字段
}

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