from typing import Optional, List, Any
from datetime import datetime

from ....core.enums.state import State
from ....core.interfaces.dto import Dto
from ....core.interfaces.core import Core
from ....enums.content.tickets import TicketPriority, TicketStatus


class Ticket[Properties: Any](Core[Properties]):
  title: str
  type: Optional[str]

  state: Optional[State]
  status: TicketStatus
  priority: TicketPriority

  parent: Optional[str]  # Ticket ID

  rate: Optional[float]
  votes: Optional[int]
  rating: Optional[float]

  content: str
  department: Optional[str]

  due_date: Optional[datetime]

  assigned_to: Optional[str]  # User ID

  solution: Optional[str]
  attachments: Optional[List[str]]  # File ID's

  feedback: Optional[str]  # Note ID
  related_tickets: Optional[List[str]]


# ----------------------------------------
# Data Transfer Object Interface
# ----------------------------------------


class TicketDto[Properties: Any](Dto[Properties]):
  title: str
  type: Optional[str]

  state: Optional[State]
  status: TicketStatus
  priority: TicketPriority

  parent: Optional[str]  # Ticket ID

  rate: Optional[float]
  votes: Optional[int]
  rating: Optional[float]

  content: str
  department: Optional[str]

  due_date: Optional[datetime]

  assigned_to: Optional[str]  # User ID

  solution: Optional[str]
  attachments: Optional[List[str]]  # File ID's

  feedback: Optional[str]  # Note ID
  related_tickets: Optional[List[str]]
