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

// EventV1OutApproval 了解事件订阅的使用场景和配置流程, 请点击查看 [事件订阅概述](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM)。
//
// 「审批」应用的表单里如果包含 [外出控件组], 则在此表单审批通过后触发此事件。
// * 依赖权限: [访问审批应用] 或 [查看、创建、更新、删除审批应用相关信息]
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uIDO24iM4YjLygjN/event/out-of-office
// new doc: https://open.feishu.cn/document/server-docs/approval-v4/event/special-event/out-of-office
func (r *EventCallbackService) HandlerEventV1OutApproval(f EventV1OutApprovalHandler) {
	r.cli.eventHandler.eventV1OutApprovalHandler = f
}

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

// EventV1OutApproval ...
type EventV1OutApproval struct {
	AppID         string                                 `json:"app_id,omitempty"` // 如: cli_9e28cb7ba56a100e
	I18nResources []*EventV1OutApprovalEventI18nResource `json:"i18n_resources,omitempty"`
	InstanceCode  string                                 `json:"instance_code,omitempty"` // 此审批的唯一标识. 如: 59558CEE-CEF4-45C9-A2C3-DCBF8BEC7341
	OutImage      string                                 `json:"out_image,omitempty"`
	OutInterval   int64                                  `json:"out_interval,omitempty"`   // 外出时长, 单位秒. 如: 10800
	OutName       string                                 `json:"out_name,omitempty"`       // 通过i18n_resources里的信息换取相应语言的文案. 如: @i18n@someKey
	OutReason     string                                 `json:"out_reason,omitempty"`     // 如: 外出事由
	OutStartTime  string                                 `json:"out_start_time,omitempty"` // 如: 2020-05-15 15:00:00
	OutEndTime    string                                 `json:"out_end_time,omitempty"`   // 如: 2020-05-15 18:00:00
	OutUnit       string                                 `json:"out_unit,omitempty"`       // 外出时长的单位, HOUR 小时, DAY 天, HALF_DAY 半天. 如: HOUR
	StartTime     int64                                  `json:"start_time,omitempty"`     // 审批开始时间, 单位: 秒. 如: 1589527346
	EndTime       int64                                  `json:"end_time,omitempty"`       // 审批结束时间, 单位: 秒. 如: 1589527354
	TenantKey     string                                 `json:"tenant_key,omitempty"`     // 企业唯一标识. 如: 2d520d3b434f175e
	Type          string                                 `json:"type,omitempty"`           // 事件类型. 如: out_approval
	OpenID        string                                 `json:"open_id,omitempty"`        // 申请发起人open_id. 如: ou_xxx
	UserID        string                                 `json:"user_id,omitempty"`        // 申请发起人. 如: g6964gd3
}

// EventV1OutApprovalEventI18nResource ...
type EventV1OutApprovalEventI18nResource struct {
	IsDefault bool              `json:"is_default,omitempty"` // 如: true
	Locale    string            `json:"locale,omitempty"`     // 如: zh_cn
	Texts     map[string]string `json:"texts,omitempty"`
}
