# Code generated by lark_sdk_gen. DO NOT EDIT.

from pylark.lark_request import RawRequestReq, _new_method_option
import attr
import typing
import io


@attr.s
class GetHelpdeskTicketReq(object):
    ticket_id: str = attr.ib(
        default="", metadata={"req_type": "path"}
    )  # ticket id, 示例值："123456"


@attr.s
class GetHelpdeskTicketRespTicketAgentServiceDuration(object):
    pass


@attr.s
class GetHelpdeskTicketRespTicketCustomizedField(object):
    id: str = attr.ib(default="", metadata={"req_type": "json"})  # 自定义字段ID
    value: str = attr.ib(default="", metadata={"req_type": "json"})  # 自定义字段值
    key_name: str = attr.ib(default="", metadata={"req_type": "json"})  # 键名
    display_name: str = attr.ib(default="", metadata={"req_type": "json"})  # 展示名称
    position: int = attr.ib(default=0, metadata={"req_type": "json"})  # 展示位置
    required: bool = attr.ib(
        factory=lambda: bool(), metadata={"req_type": "json"}
    )  # 是否必填
    editable: bool = attr.ib(
        factory=lambda: bool(), metadata={"req_type": "json"}
    )  # 是否可修改


@attr.s
class GetHelpdeskTicketRespTicketCollaborator(object):
    id: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户ID
    avatar_url: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户头像url
    name: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户名
    email: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户邮箱
    department: str = attr.ib(default="", metadata={"req_type": "json"})  # 所在部门名称


@attr.s
class GetHelpdeskTicketRespTicketClosedBy(object):
    id: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户ID
    avatar_url: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户头像url
    name: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户名
    email: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户邮箱
    department: str = attr.ib(default="", metadata={"req_type": "json"})  # 所在部门名称


@attr.s
class GetHelpdeskTicketRespTicketAgent(object):
    id: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户ID
    avatar_url: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户头像url
    name: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户名
    email: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户邮箱
    department: str = attr.ib(default="", metadata={"req_type": "json"})  # 所在部门名称


@attr.s
class GetHelpdeskTicketRespTicketGuest(object):
    id: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户ID
    avatar_url: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户头像url
    name: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户名
    email: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户邮箱
    department: str = attr.ib(default="", metadata={"req_type": "json"})  # 所在部门名称


@attr.s
class GetHelpdeskTicketRespTicket(object):
    ticket_id: str = attr.ib(default="", metadata={"req_type": "json"})  # 工单ID
    helpdesk_id: str = attr.ib(default="", metadata={"req_type": "json"})  # 服务台ID
    guest: GetHelpdeskTicketRespTicketGuest = attr.ib(
        default=None, metadata={"req_type": "json"}
    )  # 工单创建用户
    stage: int = attr.ib(default=0, metadata={"req_type": "json"})  # 工单阶段，1：bot，2：人工
    status: int = attr.ib(
        default=0, metadata={"req_type": "json"}
    )  # 工单状态，1：已创建 2: 处理中 3: 排队中 4：待定 5：待用户响应 50: 被机器人关闭 51: 被人工关闭
    score: int = attr.ib(
        default=0, metadata={"req_type": "json"}
    )  # 工单评分，1：不满意，2:一般，3:满意
    created_at: int = attr.ib(default=0, metadata={"req_type": "json"})  # 工单创建时间
    updated_at: int = attr.ib(
        default=0, metadata={"req_type": "json"}
    )  # 工单更新时间，没有值时为-1
    closed_at: int = attr.ib(default=0, metadata={"req_type": "json"})  # 工单结束时间
    agents: typing.List[GetHelpdeskTicketRespTicketAgent] = attr.ib(
        factory=lambda: [], metadata={"req_type": "json"}
    )  # 工单客服
    channel: int = attr.ib(default=0, metadata={"req_type": "json"})  # 工单渠道
    solve: int = attr.ib(default=0, metadata={"req_type": "json"})  # 工单是否解决 1:没解决 2:已解决
    closed_by: GetHelpdeskTicketRespTicketClosedBy = attr.ib(
        default=None, metadata={"req_type": "json"}
    )  # 关单用户ID
    collaborators: typing.List[GetHelpdeskTicketRespTicketCollaborator] = attr.ib(
        factory=lambda: [], metadata={"req_type": "json"}
    )  # 工单协作者
    customized_fields: typing.List[
        GetHelpdeskTicketRespTicketCustomizedField
    ] = attr.ib(
        factory=lambda: [], metadata={"req_type": "json"}
    )  # 自定义字段列表，没有值时不设置
    agent_service_duration: float = attr.ib(
        default=None, metadata={"req_type": "json"}
    )  # 客服服务时长minutes
    agent_first_response_duration: int = attr.ib(
        default=0, metadata={"req_type": "json"}
    )  # 客服第一反应时间 seconds
    bot_service_duration: int = attr.ib(
        default=0, metadata={"req_type": "json"}
    )  # 机器人服务时长 seconds
    agent_resolution_time: int = attr.ib(
        default=0, metadata={"req_type": "json"}
    )  # 解决时长(秒)
    actual_processing_time: int = attr.ib(
        default=0, metadata={"req_type": "json"}
    )  # 处理时长(秒)


@attr.s
class GetHelpdeskTicketResp(object):
    ticket: GetHelpdeskTicketRespTicket = attr.ib(
        default=None, metadata={"req_type": "json"}
    )  # 工单详情


def _gen_get_helpdesk_ticket_req(request, options) -> RawRequestReq:
    return RawRequestReq(
        dataclass=GetHelpdeskTicketResp,
        scope="Helpdesk",
        api="GetHelpdeskTicket",
        method="GET",
        url="https://open.feishu.cn/open-apis/helpdesk/v1/tickets/:ticket_id",
        body=request,
        method_option=_new_method_option(options),
        need_tenant_access_token=True,
        need_helpdesk_auth=True,
    )
