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

// EventV1RemoveUserFromChat 如果你希望订阅机器人进出群、群内有人@机器人事件, 请前往[机器人进群](https://open.feishu.cn/document/ukTMukTMukTM/ugzMugzMugzM/event/bot-added-to-group) 或 [机器人退群](https://open.feishu.cn/document/ukTMukTMukTM/ucDO04yN4QjL3gDN)。
//
// 为了更好地提升该事件的安全性, 我们对其进行了升级, 请尽快迁移至
// [新版本（用户进群）](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat-member-user/events/added)
// 或[新版本（用户出群）>>](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat-member-user/events/deleted)
// 用户进群、出群后触发此事件。
// * 特殊说明: 只有开启机器人能力并且机器人所在的群发生上述变化时才能触发此事件。
// 事件包括三个类型:
// - 用户进群 - add_user_to_chat
// - 用户出群 - remove_user_from_chat
// - 撤销加人 - revoke_add_user_from_chat
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uQDOwUjL0gDM14CN4ATN/event/user-joins-or-leave-group
func (r *EventCallbackService) HandlerEventV1RemoveUserFromChat(f EventV1RemoveUserFromChatHandler) {
	r.cli.eventHandler.eventV1RemoveUserFromChatHandler = f
}

// EventV1RemoveUserFromChatHandler event EventV1RemoveUserFromChat handler
type EventV1RemoveUserFromChatHandler func(ctx context.Context, cli *Lark, schema string, header *EventHeaderV1, event *EventV1RemoveUserFromChat) (string, error)

// EventV1RemoveUserFromChat ...
type EventV1RemoveUserFromChat struct {
	AppID     string                                  `json:"app_id,omitempty"`     // 如: cli_9c8609450f78d102
	ChatID    string                                  `json:"chat_id,omitempty"`    // 群聊的id. 如: oc_9e9619b938c9571c1c3165681cdaead5
	Operator  *EventV1RemoveUserFromChatEventOperator `json:"operator,omitempty"`   // 用户进出群的操作人。用户主动退群的话, operator 就是user自己
	TenantKey string                                  `json:"tenant_key,omitempty"` // 如: 736588c9260f175d
	Type      string                                  `json:"type,omitempty"`       // 事件类型, add_user_to_chat/remove_user_from_chat/revoke_add_user_from_chat. 如: add_user_to_chat
	Users     []*EventV1RemoveUserFromChatEventUser   `json:"users,omitempty"`
}

// EventV1RemoveUserFromChatEventOperator ...
type EventV1RemoveUserFromChatEventOperator struct {
	OpenID string `json:"open_id,omitempty"` // 员工对此应用的唯一标识, 同一员工对不同应用的open_id不同. 如: ou_18eac85d35a26f989317ad4f02e8bbbb
	UserID string `json:"user_id,omitempty"` // 即“用户ID”, 仅企业自建应用会返回. 如: ca51d83b
}

// EventV1RemoveUserFromChatEventUser ...
type EventV1RemoveUserFromChatEventUser struct {
	Name   string `json:"name,omitempty"`    // 如: James
	OpenID string `json:"open_id,omitempty"` // 如: ou_706adeb944ab1473b9fb3e7da2a40b68
	UserID string `json:"user_id,omitempty"` // 如: 51g97a4g
}
