// Package dispatcher code generated by oapi sdk gen
/*
 * MIT License
 *
 * Copyright (c) 2022 Lark Technologies Pte. Ltd.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package dispatcher

import (
	"context"
	"github.com/larksuite/oapi-sdk-go/v3/service/helpdesk/v1"
)
// 审核事件
//
// - Push审核状态通知事件
//
// - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/notification/events/approve
func ( dispatcher * EventDispatcher ) OnP2NotificationApproveV1(handler func(ctx context.Context, event *larkhelpdesk.P2NotificationApproveV1) error) * EventDispatcher{
	_, existed := dispatcher.eventType2EventHandler["helpdesk.notification.approve_v1"]
	if existed {
		panic("event: multiple handler registrations for " + "helpdesk.notification.approve_v1")
	}
	dispatcher.eventType2EventHandler["helpdesk.notification.approve_v1"] = larkhelpdesk.NewP2NotificationApproveV1Handler(handler)
	return dispatcher
}
// 工单创建事件
//
// - 可监听服务台的工单创建事件。需使用订阅接口订阅：[事件订阅](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/event/overview)
//
// - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/ticket/events/created
func ( dispatcher * EventDispatcher ) OnP2TicketCreatedV1(handler func(ctx context.Context, event *larkhelpdesk.P2TicketCreatedV1) error) * EventDispatcher{
	_, existed := dispatcher.eventType2EventHandler["helpdesk.ticket.created_v1"]
	if existed {
		panic("event: multiple handler registrations for " + "helpdesk.ticket.created_v1")
	}
	dispatcher.eventType2EventHandler["helpdesk.ticket.created_v1"] = larkhelpdesk.NewP2TicketCreatedV1Handler(handler)
	return dispatcher
}
// 工单状态变更事件
//
// - 可监听工单状态和阶段变更事件。需使用订阅接口订阅：[事件订阅](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/event/overview)
//
// - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/ticket/events/updated
func ( dispatcher * EventDispatcher ) OnP2TicketUpdatedV1(handler func(ctx context.Context, event *larkhelpdesk.P2TicketUpdatedV1) error) * EventDispatcher{
	_, existed := dispatcher.eventType2EventHandler["helpdesk.ticket.updated_v1"]
	if existed {
		panic("event: multiple handler registrations for " + "helpdesk.ticket.updated_v1")
	}
	dispatcher.eventType2EventHandler["helpdesk.ticket.updated_v1"] = larkhelpdesk.NewP2TicketUpdatedV1Handler(handler)
	return dispatcher
}
// 工单消息事件
//
// - 该消息事件属于工单消息事件。需使用订阅接口订阅：[事件订阅](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/event/overview)
//
// - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/ticket_message/events/created
func ( dispatcher * EventDispatcher ) OnP2TicketMessageCreatedV1(handler func(ctx context.Context, event *larkhelpdesk.P2TicketMessageCreatedV1) error) * EventDispatcher{
	_, existed := dispatcher.eventType2EventHandler["helpdesk.ticket_message.created_v1"]
	if existed {
		panic("event: multiple handler registrations for " + "helpdesk.ticket_message.created_v1")
	}
	dispatcher.eventType2EventHandler["helpdesk.ticket_message.created_v1"] = larkhelpdesk.NewP2TicketMessageCreatedV1Handler(handler)
	return dispatcher
}