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

// EventV1LeaveApprovalV2 了解事件订阅的使用场景和配置流程, 请点击查看 [事件订阅概述](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM)
//
// 「审批」应用的表单里如果包含 [请假控件组], 则在此表单审批通过后触发此事件。
// * 特殊说明: 如果你订阅了此事件, 会收到2条消息, 其 [type] 分别为 [leave_approval]、 [leave_approvalV2] 。这两个事件的 [uuid] 不同、 [instance_code] 相同。
// * 依赖权限: [访问审批应用] 或 [查看、创建、更新、删除审批应用相关信息]
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uIDO24iM4YjLygjN/event/leave
// new doc: https://open.feishu.cn/document/server-docs/approval-v4/event/special-event/leave
func (r *EventCallbackService) HandlerEventV1LeaveApprovalV2(f EventV1LeaveApprovalV2Handler) {
	r.cli.eventHandler.eventV1LeaveApprovalV2Handler = f
}

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

// EventV1LeaveApprovalV2 ...
type EventV1LeaveApprovalV2 struct {
	AppID                  string                                     `json:"app_id,omitempty"`                    // 如: cli_xxx
	TenantKey              string                                     `json:"tenant_key,omitempty"`                // 如: xxx
	Type                   string                                     `json:"type,omitempty"`                      // 如: leave_approvalV2
	InstanceCode           string                                     `json:"instance_code,omitempty"`             // 审批实例Code. 如: xxx
	UserID                 string                                     `json:"user_id,omitempty"`                   // 用户id. 如: xxx
	OpenID                 string                                     `json:"open_id,omitempty"`                   // 用户open_id. 如: ou_xxx
	OriginInstanceCode     string                                     `json:"origin_instance_code,omitempty"`      // 销假单关联的原始单据. 如: xxxx
	StartTime              int64                                      `json:"start_time,omitempty"`                // 审批发起时间, 单位: 秒. 如: 1564590532
	EndTime                int64                                      `json:"end_time,omitempty"`                  // 审批结束时间, 单位: 秒. 如: 1564590532
	LeaveFeedingArriveLate int64                                      `json:"leave_feeding_arrive_late,omitempty"` // 上班晚到（哺乳假相关）. 如: 0
	LeaveFeedingLeaveEarly int64                                      `json:"leave_feeding_leave_early,omitempty"` // 下班早走（哺乳假相关）. 如: 0
	LeaveFeedingRestDaily  int64                                      `json:"leave_feeding_rest_daily,omitempty"`  // 每日休息（哺乳假相关）. 如: 0
	LeaveName              string                                     `json:"leave_name,omitempty"`                // 假期名称. 如: @i18n@123456
	LeaveUnit              string                                     `json:"leave_unit,omitempty"`                // 请假最小时长. 如: DAY
	LeaveStartTime         string                                     `json:"leave_start_time,omitempty"`          // 请假开始时间. 如: 2019-10-01 00:00:00
	LeaveEndTime           string                                     `json:"leave_end_time,omitempty"`            // 请假结束时间. 如: 2019-10-02 00:00:00
	LeaveDetail            [][]string                                 `json:"leave_detail,omitempty"`              // 具体的请假明细时间
	LeaveRange             [][]string                                 `json:"leave_range,omitempty"`               // 具体的请假时间范围
	LeaveInterval          int64                                      `json:"leave_interval,omitempty"`            // 请假时长, 单位（秒）. 如: 86400
	LeaveReason            string                                     `json:"leave_reason,omitempty"`              // 请假事由. 如: abc
	I18nResources          []*EventV1LeaveApprovalV2EventI18nResource `json:"i18n_resources,omitempty"`            // 国际化文案
}

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