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

// CreateCalendarEventMeetingChat 调用该接口以当前身份（应用或用户）为指定日程创建一个会议群。
//
// - 当前身份由 Header Authorization 的 Token 类型决定。tenant_access_token 指应用身份, user_access_token 指用户身份。
// - 如果使用应用身份调用该接口, 则需要确保应用开启了[机器人能力](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-enable-bot-ability)。
// - 日程所在的日历需要是当前身份的主日历, 且具有日历的 writer 权限。你可以调用[查询主日历信息](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/primary)接口, 获取当前身份的主日历信息。
// - 日程需要添加了至少 2 个参与人, 且不隐藏参与人列表。你可以调用[获取日程参与人列表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event-attendee/list)接口获取日程的参与人情况；可以调用[获取日程](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/get)接口, 查看日程参与人权限信息（attendee_ability）。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event-meeting_chat/create
func (r *CalendarService) CreateCalendarEventMeetingChat(ctx context.Context, request *CreateCalendarEventMeetingChatReq, options ...MethodOptionFunc) (*CreateCalendarEventMeetingChatResp, *Response, error) {
	if r.cli.mock.mockCalendarCreateCalendarEventMeetingChat != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Calendar#CreateCalendarEventMeetingChat mock enable")
		return r.cli.mock.mockCalendarCreateCalendarEventMeetingChat(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Calendar",
		API:                   "CreateCalendarEventMeetingChat",
		Method:                "POST",
		URL:                   r.cli.openBaseURL + "/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/meeting_chat",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(createCalendarEventMeetingChatResp)

	response, err := r.cli.RawRequest(ctx, req, resp)
	return resp.Data, response, err
}

// MockCalendarCreateCalendarEventMeetingChat mock CalendarCreateCalendarEventMeetingChat method
func (r *Mock) MockCalendarCreateCalendarEventMeetingChat(f func(ctx context.Context, request *CreateCalendarEventMeetingChatReq, options ...MethodOptionFunc) (*CreateCalendarEventMeetingChatResp, *Response, error)) {
	r.mockCalendarCreateCalendarEventMeetingChat = f
}

// UnMockCalendarCreateCalendarEventMeetingChat un-mock CalendarCreateCalendarEventMeetingChat method
func (r *Mock) UnMockCalendarCreateCalendarEventMeetingChat() {
	r.mockCalendarCreateCalendarEventMeetingChat = nil
}

// CreateCalendarEventMeetingChatReq ...
type CreateCalendarEventMeetingChatReq struct {
	CalendarID string `path:"calendar_id" json:"-"` // 日程所在的日历 ID。了解更多, 参见[日历 ID 说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/introduction), 示例值: "feishu.cn_xxx@group.calendar.feishu.cn"
	EventID    string `path:"event_id" json:"-"`    // 日程 ID, 创建日程时会返回日程 ID。你也可以调用以下接口获取某一日历的 ID, [获取日程列表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/list), [搜索日程](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/search), 示例值: "75d28f9b-e35c-4230-8a83-123_0"
}

// CreateCalendarEventMeetingChatResp ...
type CreateCalendarEventMeetingChatResp struct {
	MeetingChatID string `json:"meeting_chat_id,omitempty"` // 会议群 ID。后续可用于解绑会议群。
	Applink       string `json:"applink,omitempty"`         // 群分享链接。
}

// createCalendarEventMeetingChatResp ...
type createCalendarEventMeetingChatResp struct {
	Code  int64                               `json:"code,omitempty"` // 错误码, 非 0 表示失败
	Msg   string                              `json:"msg,omitempty"`  // 错误描述
	Data  *CreateCalendarEventMeetingChatResp `json:"data,omitempty"`
	Error *ErrorDetail                        `json:"error,omitempty"`
}
