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

// GetTaskComment 给定一个评论的ID, 返回评论的详情, 包括内容, 创建人, 创建时间和更新时间等信息。
//
// 获取任务的评论详情需要评论归属任务的读取权限, 详情见[任务功能概述](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/task-v2/task/overview)中的“任务是如何鉴权的？”章节。
//
// doc: https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/task-v2/comment/get
func (r *TaskService) GetTaskComment(ctx context.Context, request *GetTaskCommentReq, options ...MethodOptionFunc) (*GetTaskCommentResp, *Response, error) {
	if r.cli.mock.mockTaskGetTaskComment != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Task#GetTaskComment mock enable")
		return r.cli.mock.mockTaskGetTaskComment(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Task",
		API:                   "GetTaskComment",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/task/v2/comments/:comment_id",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(getTaskCommentResp)

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

// MockTaskGetTaskComment mock TaskGetTaskComment method
func (r *Mock) MockTaskGetTaskComment(f func(ctx context.Context, request *GetTaskCommentReq, options ...MethodOptionFunc) (*GetTaskCommentResp, *Response, error)) {
	r.mockTaskGetTaskComment = f
}

// UnMockTaskGetTaskComment un-mock TaskGetTaskComment method
func (r *Mock) UnMockTaskGetTaskComment() {
	r.mockTaskGetTaskComment = nil
}

// GetTaskCommentReq ...
type GetTaskCommentReq struct {
	CommentID  string  `path:"comment_id" json:"-"`    // 要获取评论详情的评论ID, 示例值: "7198104824246747156", 最大长度: `50` 字符
	UserIDType *IDType `query:"user_id_type" json:"-"` // 用户 ID 类型, 示例值: open_id, 默认值: `open_id`
}

// GetTaskCommentResp ...
type GetTaskCommentResp struct {
	Comment *GetTaskCommentRespComment `json:"comment,omitempty"` // 评论详情
}

// GetTaskCommentRespComment ...
type GetTaskCommentRespComment struct {
	ID               string                            `json:"id,omitempty"`                  // 评论id
	Content          string                            `json:"content,omitempty"`             // 评论内容
	Creator          *GetTaskCommentRespCommentCreator `json:"creator,omitempty"`             // 评论创建人
	ReplyToCommentID string                            `json:"reply_to_comment_id,omitempty"` // 回复给评论的id。如果不是回复评论, 则为空。
	CreatedAt        string                            `json:"created_at,omitempty"`          // 评论创建时间戳（ms)
	UpdatedAt        string                            `json:"updated_at,omitempty"`          // 评论更新时间戳（ms）
	ResourceType     string                            `json:"resource_type,omitempty"`       // 任务关联的资源类型
	ResourceID       string                            `json:"resource_id,omitempty"`         // 任务关联的资源ID
}

// GetTaskCommentRespCommentCreator ...
type GetTaskCommentRespCommentCreator struct {
	ID   string `json:"id,omitempty"`   // 表示member的id
	Type string `json:"type,omitempty"` // 成员的类型
	Role string `json:"role,omitempty"` // 成员角色
}

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