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

// EventV2HelpdeskTicketUpdatedV1 可监听工单状态和阶段变更事件。需使用订阅接口订阅: [事件订阅](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/event/subscribe)。
//
// 如果你需要监听工单的阶段变更, 可以使用该事件。例如, 使用该事件监听工单阶段由机器人变更为人工。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/ticket/events/updated
// new doc: https://open.feishu.cn/document/server-docs/helpdesk-v1/ticket-management/ticket/events/updated
func (r *EventCallbackService) HandlerEventV2HelpdeskTicketUpdatedV1(f EventV2HelpdeskTicketUpdatedV1Handler) {
	r.cli.eventHandler.eventV2HelpdeskTicketUpdatedV1Handler = f
}

// EventV2HelpdeskTicketUpdatedV1Handler event EventV2HelpdeskTicketUpdatedV1 handler
type EventV2HelpdeskTicketUpdatedV1Handler func(ctx context.Context, cli *Lark, schema string, header *EventHeaderV2, event *EventV2HelpdeskTicketUpdatedV1) (string, error)

// EventV2HelpdeskTicketUpdatedV1 ...
type EventV2HelpdeskTicketUpdatedV1 struct {
	Object    *EventV2HelpdeskTicketUpdatedV1Object    `json:"object,omitempty"`     // ticket after update
	OldObject *EventV2HelpdeskTicketUpdatedV1OldObject `json:"old_object,omitempty"` // ticket before update, only has updated fields
}

// EventV2HelpdeskTicketUpdatedV1Object ...
type EventV2HelpdeskTicketUpdatedV1Object struct {
	TicketID         string                                                 `json:"ticket_id,omitempty"`         // 工单ID, [可以从工单列表里面取](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/ticket/list), [也可以订阅工单创建事件获取](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/ticket/events/created)
	HelpdeskID       string                                                 `json:"helpdesk_id,omitempty"`       // 服务台id
	Guest            *EventV2HelpdeskTicketUpdatedV1ObjectGuest             `json:"guest,omitempty"`             // 用户id
	Stage            int64                                                  `json:"stage,omitempty"`             // 工单阶段: 1. 机器人 2. 人工
	Status           int64                                                  `json:"status,omitempty"`            // 工单状态, 1: 已创建 2: 处理中 3: 排队中 4: 待定 5: 待用户响应 50: 被机器人关闭 51: 被客服关闭 52: 用户自己关闭
	Score            int64                                                  `json:"score,omitempty"`             // 工单评分, 1: 不满意, 2:一般, 3:满意
	CreatedAt        int64                                                  `json:"created_at,omitempty"`        // 创建时间
	UpdatedAt        int64                                                  `json:"updated_at,omitempty"`        // 工单更新时间, 没有值时为-1
	ClosedAt         int64                                                  `json:"closed_at,omitempty"`         // 关单时间
	Channel          int64                                                  `json:"channel,omitempty"`           // 工单渠道, 描述: 9: Open API 2: 二维码 14: 分享 13: 搜索 其他数字: 其他渠道
	Solve            int64                                                  `json:"solve,omitempty"`             // 工单是否解决 1:没解决 2:已解决
	CustomizedFields []*EventV2HelpdeskTicketUpdatedV1ObjectCustomizedField `json:"customized_fields,omitempty"` // 自定义字段
	ChatID           string                                                 `json:"chat_id,omitempty"`           // oc_xxxxxxx
}

// EventV2HelpdeskTicketUpdatedV1ObjectCustomizedField ...
type EventV2HelpdeskTicketUpdatedV1ObjectCustomizedField struct {
	ID          string `json:"id,omitempty"`           // 自定义字段ID
	Value       string `json:"value,omitempty"`        // 自定义字段值
	KeyName     string `json:"key_name,omitempty"`     // 键名
	DisplayName string `json:"display_name,omitempty"` // 展示名称
	Position    int64  `json:"position,omitempty"`     // 展示位置
	Required    bool   `json:"required,omitempty"`     // 是否必填
	Editable    bool   `json:"editable,omitempty"`     // 是否可修改
}

// EventV2HelpdeskTicketUpdatedV1ObjectGuest ...
type EventV2HelpdeskTicketUpdatedV1ObjectGuest struct {
	ID   *EventV2HelpdeskTicketUpdatedV1ObjectGuestID `json:"id,omitempty"`   // id
	Name string                                       `json:"name,omitempty"` // 名称
}

// EventV2HelpdeskTicketUpdatedV1ObjectGuestID ...
type EventV2HelpdeskTicketUpdatedV1ObjectGuestID struct {
	UnionID string `json:"union_id,omitempty"` // 用户的 union id
	UserID  string `json:"user_id,omitempty"`  // 用户的 user id, 字段权限要求: 获取用户 user ID
	OpenID  string `json:"open_id,omitempty"`  // 用户的 open id
}

// EventV2HelpdeskTicketUpdatedV1OldObject ...
type EventV2HelpdeskTicketUpdatedV1OldObject struct {
	Stage     int64 `json:"stage,omitempty"`      // ticket stage
	Status    int64 `json:"status,omitempty"`     // ticket status
	UpdatedAt int64 `json:"updated_at,omitempty"` // ticket update time
}
