# retoor <retoor@molodetz.nl>

from __future__ import annotations

from typing import Any, Optional

from devplacepy.schemas.base import _Out
from devplacepy.schemas.content import AttachmentOut


class IssueItemOut(_Out):
    number: int = 0
    title: str = ""
    state: str = "open"
    html_url: Optional[str] = None
    comments_count: int = 0
    created_at: Optional[str] = None
    updated_at: Optional[str] = None
    author_username: Optional[str] = None
    author_uid: Optional[str] = None
    author_avatar_seed: Optional[str] = None
    is_local_author: bool = False


class IssueCommentOut(_Out):
    id: int = 0
    body: str = ""
    html_url: Optional[str] = None
    created_at: Optional[str] = None
    author_username: Optional[str] = None
    author_uid: Optional[str] = None
    author_avatar_seed: Optional[str] = None
    is_local_author: bool = False
    attachments: list[AttachmentOut] = []


class IssueDetailOut(_Out):
    issue: IssueItemOut
    body: str = ""
    comments: list[IssueCommentOut] = []
    attachments: list[AttachmentOut] = []
    can_comment: bool = False
    can_attach: bool = False
    viewer_is_admin: bool = False


class IssueAttachmentsOut(_Out):
    number: int = 0
    attachments: list[AttachmentOut] = []


class IssueJobOut(_Out):
    uid: str = ""
    kind: str = ""
    status: str = ""
    number: Optional[int] = None
    issue_url: Optional[str] = None
    enhanced: bool = False
    error: Optional[str] = None
    created_at: Optional[str] = None
    completed_at: Optional[str] = None


class IssuesOut(_Out):
    issues: list[IssueItemOut] = []
    pagination: Optional[Any] = None
    state: str = "open"
    configured: bool = True
    error_message: Optional[str] = None
    viewer_is_admin: bool = False


class AdminPlanningTicketOut(_Out):
    number: int = 0
    title: str = ""
    labels: list[str] = []


class AdminIssuesPlanningOut(_Out):
    configured: bool = True
    tickets: list[AdminPlanningTicketOut] = []
    tickets_error: bool = False
