# Code generated by Lark OpenAPI.

from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type
from lark_oapi.core.construct import init
from .ticket_user import TicketUser
from .comments import Comments
from .i18n import I18n
from .ticket_user import TicketUser
from .ticket_user import TicketUser
from .ticket_user import TicketUser
from .customized_field_display_item import CustomizedFieldDisplayItem
from .ticket_user import TicketUser
from .ticket_tag import TicketTag


class TicketV2(object):
    _types = {
        "ticket_id": str,
        "helpdesk_id": str,
        "guest": TicketUser,
        "comments": Comments,
        "ticket_type": int,
        "status": int,
        "score": int,
        "created_at": int,
        "updated_at": int,
        "closed_at": int,
        "dissatisfaction_reason": I18n,
        "agents": List[TicketUser],
        "channel": int,
        "solve": int,
        "closed_by": TicketUser,
        "collaborators": List[TicketUser],
        "customized_fields": List[CustomizedFieldDisplayItem],
        "agent_service_duration": float,
        "agent_first_response_duration": int,
        "bot_service_duration": int,
        "agent_resolution_time": int,
        "actual_processing_time": int,
        "agent_entry_time": int,
        "agent_first_response_time": int,
        "agent_last_response_time": int,
        "agent_owner": TicketUser,
        "tags": List[TicketTag],
    }

    def __init__(self, d=None):
        self.ticket_id: Optional[str] = None
        self.helpdesk_id: Optional[str] = None
        self.guest: Optional[TicketUser] = None
        self.comments: Optional[Comments] = None
        self.ticket_type: Optional[int] = None
        self.status: Optional[int] = None
        self.score: Optional[int] = None
        self.created_at: Optional[int] = None
        self.updated_at: Optional[int] = None
        self.closed_at: Optional[int] = None
        self.dissatisfaction_reason: Optional[I18n] = None
        self.agents: Optional[List[TicketUser]] = None
        self.channel: Optional[int] = None
        self.solve: Optional[int] = None
        self.closed_by: Optional[TicketUser] = None
        self.collaborators: Optional[List[TicketUser]] = None
        self.customized_fields: Optional[List[CustomizedFieldDisplayItem]] = None
        self.agent_service_duration: Optional[float] = None
        self.agent_first_response_duration: Optional[int] = None
        self.bot_service_duration: Optional[int] = None
        self.agent_resolution_time: Optional[int] = None
        self.actual_processing_time: Optional[int] = None
        self.agent_entry_time: Optional[int] = None
        self.agent_first_response_time: Optional[int] = None
        self.agent_last_response_time: Optional[int] = None
        self.agent_owner: Optional[TicketUser] = None
        self.tags: Optional[List[TicketTag]] = None
        init(self, d, self._types)

    @staticmethod
    def builder() -> "TicketV2Builder":
        return TicketV2Builder()


class TicketV2Builder(object):
    def __init__(self) -> None:
        self._ticket_v2 = TicketV2()

    def ticket_id(self, ticket_id: str) -> "TicketV2Builder":
        self._ticket_v2.ticket_id = ticket_id
        return self

    def helpdesk_id(self, helpdesk_id: str) -> "TicketV2Builder":
        self._ticket_v2.helpdesk_id = helpdesk_id
        return self

    def guest(self, guest: TicketUser) -> "TicketV2Builder":
        self._ticket_v2.guest = guest
        return self

    def comments(self, comments: Comments) -> "TicketV2Builder":
        self._ticket_v2.comments = comments
        return self

    def ticket_type(self, ticket_type: int) -> "TicketV2Builder":
        self._ticket_v2.ticket_type = ticket_type
        return self

    def status(self, status: int) -> "TicketV2Builder":
        self._ticket_v2.status = status
        return self

    def score(self, score: int) -> "TicketV2Builder":
        self._ticket_v2.score = score
        return self

    def created_at(self, created_at: int) -> "TicketV2Builder":
        self._ticket_v2.created_at = created_at
        return self

    def updated_at(self, updated_at: int) -> "TicketV2Builder":
        self._ticket_v2.updated_at = updated_at
        return self

    def closed_at(self, closed_at: int) -> "TicketV2Builder":
        self._ticket_v2.closed_at = closed_at
        return self

    def dissatisfaction_reason(self, dissatisfaction_reason: I18n) -> "TicketV2Builder":
        self._ticket_v2.dissatisfaction_reason = dissatisfaction_reason
        return self

    def agents(self, agents: List[TicketUser]) -> "TicketV2Builder":
        self._ticket_v2.agents = agents
        return self

    def channel(self, channel: int) -> "TicketV2Builder":
        self._ticket_v2.channel = channel
        return self

    def solve(self, solve: int) -> "TicketV2Builder":
        self._ticket_v2.solve = solve
        return self

    def closed_by(self, closed_by: TicketUser) -> "TicketV2Builder":
        self._ticket_v2.closed_by = closed_by
        return self

    def collaborators(self, collaborators: List[TicketUser]) -> "TicketV2Builder":
        self._ticket_v2.collaborators = collaborators
        return self

    def customized_fields(self, customized_fields: List[CustomizedFieldDisplayItem]) -> "TicketV2Builder":
        self._ticket_v2.customized_fields = customized_fields
        return self

    def agent_service_duration(self, agent_service_duration: float) -> "TicketV2Builder":
        self._ticket_v2.agent_service_duration = agent_service_duration
        return self

    def agent_first_response_duration(self, agent_first_response_duration: int) -> "TicketV2Builder":
        self._ticket_v2.agent_first_response_duration = agent_first_response_duration
        return self

    def bot_service_duration(self, bot_service_duration: int) -> "TicketV2Builder":
        self._ticket_v2.bot_service_duration = bot_service_duration
        return self

    def agent_resolution_time(self, agent_resolution_time: int) -> "TicketV2Builder":
        self._ticket_v2.agent_resolution_time = agent_resolution_time
        return self

    def actual_processing_time(self, actual_processing_time: int) -> "TicketV2Builder":
        self._ticket_v2.actual_processing_time = actual_processing_time
        return self

    def agent_entry_time(self, agent_entry_time: int) -> "TicketV2Builder":
        self._ticket_v2.agent_entry_time = agent_entry_time
        return self

    def agent_first_response_time(self, agent_first_response_time: int) -> "TicketV2Builder":
        self._ticket_v2.agent_first_response_time = agent_first_response_time
        return self

    def agent_last_response_time(self, agent_last_response_time: int) -> "TicketV2Builder":
        self._ticket_v2.agent_last_response_time = agent_last_response_time
        return self

    def agent_owner(self, agent_owner: TicketUser) -> "TicketV2Builder":
        self._ticket_v2.agent_owner = agent_owner
        return self

    def tags(self, tags: List[TicketTag]) -> "TicketV2Builder":
        self._ticket_v2.tags = tags
        return self

    def build(self) -> "TicketV2":
        return self._ticket_v2
