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

// GetHelpdeskAgentSkill 该接口用于获取客服技能。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/agent_skill/get
// new doc: https://open.feishu.cn/document/server-docs/helpdesk-v1/agent-function/agent_skill/get
func (r *HelpdeskService) GetHelpdeskAgentSkill(ctx context.Context, request *GetHelpdeskAgentSkillReq, options ...MethodOptionFunc) (*GetHelpdeskAgentSkillResp, *Response, error) {
	if r.cli.mock.mockHelpdeskGetHelpdeskAgentSkill != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Helpdesk#GetHelpdeskAgentSkill mock enable")
		return r.cli.mock.mockHelpdeskGetHelpdeskAgentSkill(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Helpdesk",
		API:                   "GetHelpdeskAgentSkill",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/helpdesk/v1/agent_skills/:agent_skill_id",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedHelpdeskAuth:      true,
	}
	resp := new(getHelpdeskAgentSkillResp)

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

// MockHelpdeskGetHelpdeskAgentSkill mock HelpdeskGetHelpdeskAgentSkill method
func (r *Mock) MockHelpdeskGetHelpdeskAgentSkill(f func(ctx context.Context, request *GetHelpdeskAgentSkillReq, options ...MethodOptionFunc) (*GetHelpdeskAgentSkillResp, *Response, error)) {
	r.mockHelpdeskGetHelpdeskAgentSkill = f
}

// UnMockHelpdeskGetHelpdeskAgentSkill un-mock HelpdeskGetHelpdeskAgentSkill method
func (r *Mock) UnMockHelpdeskGetHelpdeskAgentSkill() {
	r.mockHelpdeskGetHelpdeskAgentSkill = nil
}

// GetHelpdeskAgentSkillReq ...
type GetHelpdeskAgentSkillReq struct {
	AgentSkillID string `path:"agent_skill_id" json:"-"` // agent skill id, 示例值: "6941215891786825756"
}

// GetHelpdeskAgentSkillResp ...
type GetHelpdeskAgentSkillResp struct {
	AgentSkill *GetHelpdeskAgentSkillRespAgentSkill `json:"agent_skill,omitempty"` // 技能
}

// GetHelpdeskAgentSkillRespAgentSkill ...
type GetHelpdeskAgentSkillRespAgentSkill struct {
	ID        string                                      `json:"id,omitempty"`         // 技能id
	Name      string                                      `json:"name,omitempty"`       // 技能名
	Rules     []*GetHelpdeskAgentSkillRespAgentSkillRule  `json:"rules,omitempty"`      // 技能rules
	AgentIDs  []string                                    `json:"agent_ids,omitempty"`  // 具有此技能的客服ids
	IsDefault bool                                        `json:"is_default,omitempty"` // 默认技能
	Agents    []*GetHelpdeskAgentSkillRespAgentSkillAgent `json:"agents,omitempty"`     // 客服 info
}

// GetHelpdeskAgentSkillRespAgentSkillAgent ...
type GetHelpdeskAgentSkillRespAgentSkillAgent struct {
	ID        string `json:"id,omitempty"`         // user id
	AvatarURL string `json:"avatar_url,omitempty"` // user avatar url
	Name      string `json:"name,omitempty"`       // user name
}

// GetHelpdeskAgentSkillRespAgentSkillRule ...
type GetHelpdeskAgentSkillRespAgentSkillRule struct {
	ID               string  `json:"id,omitempty"`                // rule id, 参考[获取客服技能rules](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/agent_skill_rule/list) 用于获取rules options
	SelectedOperator int64   `json:"selected_operator,omitempty"` // 运算符比较, 参考[客服技能运算符选项](https://open.feishu.cn/document/ukTMukTMukTM/ucDOyYjL3gjM24yN4IjN/operator-options)
	OperatorOptions  []int64 `json:"operator_options,omitempty"`  // rule操作数value, [客服技能及运算符](https://open.feishu.cn/document/ukTMukTMukTM/ucDOyYjL3gjM24yN4IjN/operator-options)
	Operand          string  `json:"operand,omitempty"`           // rule 操作数的值
	Category         int64   `json:"category,omitempty"`          // rule 类型, 1-知识库, 2-工单信息, 3-用户飞书信息
	DisplayName      string  `json:"display_name,omitempty"`      // rule 名
}

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