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

// IsApplicationUserAdmin 该接口用于查询用户是否为应用管理员。
//
// > 此处应用管理员是指可以进入企业管理后台对应用进行审核和管理的企业管理员, 并不是应用的开发者。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uITN1EjLyUTNx4iM1UTM
// new doc: https://open.feishu.cn/document/server-docs/application-v6/admin/verify-app-admin
func (r *ApplicationService) IsApplicationUserAdmin(ctx context.Context, request *IsApplicationUserAdminReq, options ...MethodOptionFunc) (*IsApplicationUserAdminResp, *Response, error) {
	if r.cli.mock.mockApplicationIsApplicationUserAdmin != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Application#IsApplicationUserAdmin mock enable")
		return r.cli.mock.mockApplicationIsApplicationUserAdmin(ctx, request, options...)
	}

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

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

// MockApplicationIsApplicationUserAdmin mock ApplicationIsApplicationUserAdmin method
func (r *Mock) MockApplicationIsApplicationUserAdmin(f func(ctx context.Context, request *IsApplicationUserAdminReq, options ...MethodOptionFunc) (*IsApplicationUserAdminResp, *Response, error)) {
	r.mockApplicationIsApplicationUserAdmin = f
}

// UnMockApplicationIsApplicationUserAdmin un-mock ApplicationIsApplicationUserAdmin method
func (r *Mock) UnMockApplicationIsApplicationUserAdmin() {
	r.mockApplicationIsApplicationUserAdmin = nil
}

// IsApplicationUserAdminReq ...
type IsApplicationUserAdminReq struct {
	OpenID     *string `query:"open_id" json:"-"`     // 用户 open_id, open_id 和 employee_id 两个参数必须包含其一, 若同时传入取 open_id
	EmployeeID *string `query:"employee_id" json:"-"` // 用户 employee_id（同通讯录 v3 版本中的 user_id）, open_id 和 employee_id 两个参数必须包含其一, 若同时传入取 open_id
}

// IsApplicationUserAdminResp ...
type IsApplicationUserAdminResp struct {
	IsAppAdmin bool `json:"is_app_admin,omitempty"` // 用户是否为管理员, true 为是, false 为否
}

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