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

// EventV1ApprovalInstance 审批实例状态变更事件, 会在实例状态变更后, 向开发者推送审批实例状态消息。
//
// - 用户创建审批后, 推送[PENDING]状态
// - 任一审批人拒绝后, 推送[REJECTED]状态
// - 流程中所有人同意后, 推送[APPROVED]状态
// - 发起人撤回审批后, 推送[CANCELED]状态
// - 审批定义被管理员删除后, 推送[DELETED]状态
// - 发起人撤销已通过的审批, 推送[REVERTED]状态
// - 审批实例超时未处理被关闭, 推送[OVERTIME_CLOSE]状态
// - 已超时的审批实例手动恢复, 推送[OVERTIME_RECOVER]状态
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uIDO24iM4YjLygjN/event/common-event/approval-instance-event
// new doc: https://open.feishu.cn/document/server-docs/approval-v4/event/common-event/approval-instance-event
func (r *EventCallbackService) HandlerEventV1ApprovalInstance(f EventV1ApprovalInstanceHandler) {
	r.cli.eventHandler.eventV1ApprovalInstanceHandler = f
}

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

// EventV1ApprovalInstance ...
type EventV1ApprovalInstance struct {
	AppID               string `json:"app_id,omitempty"` // 如: cli_xxx
	TenantKey           string `json:"tenant_key,omitempty"`
	Type                string `json:"type,omitempty"`                  // approval_instance 固定字段
	ApprovalCode        string `json:"approval_code,omitempty"`         // 审批定义 Code
	InstanceCode        string `json:"instance_code,omitempty"`         // 审批实例 Code
	Status              string `json:"status,omitempty"`                // 实例状态 PENDING - 审批中 APPROVED - 已通过 REJECTED - 已拒绝 CANCELED -  已撤回 DELETED - 已删除 REVERTED - 已撤销 OVERTIME_CLOSE - 超时被关闭 OVERTIME_RECOVER - 超时实例被恢复
	InstanceOperateTime string `json:"instance_operate_time,omitempty"` // 事件发生时间
	UUID                string `json:"uuid,omitempty"`                  // 审批实例自定义唯一ID, 接口创建审批时候传入。
}
