# retoor <retoor@molodetz.nl>

from __future__ import annotations

from typing import Any, Optional

from devplacepy.schemas.base import _Out
from devplacepy.schemas.content import NewsOut, UserOut
from devplacepy.schemas.profile import MediaItemOut


class AdminUserOut(UserOut):
    role: Optional[str] = None
    email: Optional[str] = None
    is_active: Optional[bool] = None
    posts_count: Optional[int] = None


class AdminNewsItemOut(_Out):
    article: NewsOut
    time_ago: Optional[str] = None
    synced_at: Optional[str] = None
    grade: Optional[int] = None
    has_image: Optional[bool] = None


class AdminUsersOut(_Out):
    users: list[AdminUserOut] = []
    pagination: Optional[Any] = None
    admin_section: Optional[str] = None


class AdminNewsOut(_Out):
    articles: list[AdminNewsItemOut] = []
    pagination: Optional[Any] = None
    admin_section: Optional[str] = None


class AdminSettingsOut(_Out):
    settings: dict = {}
    admin_section: Optional[str] = None


class AdminNotificationsOut(_Out):
    notification_defaults: list[Any] = []
    admin_section: Optional[str] = None


class AdminMediaItemOut(MediaItemOut):
    deleted_at: Optional[str] = None
    uploader: Optional[str] = None


class AdminMediaOut(_Out):
    media: list[AdminMediaItemOut] = []
    pagination: Optional[Any] = None
    admin_section: Optional[str] = None


class TrashItemOut(_Out):
    uid: str
    table: str
    label: Optional[str] = None
    deleted_at: Optional[str] = None
    deleted_by: Optional[str] = None
    target_url: Optional[str] = None


class AdminTrashOut(_Out):
    items: list[TrashItemOut] = []
    table: str = "posts"
    tables: list[dict] = []
    pagination: Optional[Any] = None
    admin_section: Optional[str] = None


class AdminDeviiTaskItemOut(_Out):
    uid: str
    label: Optional[str] = None
    owner_uid: str = ""
    owner: str = ""
    owner_is_admin: bool = False
    quota: dict = {}
    schedule: str = ""
    status: str = ""
    enabled: bool = False
    run_count: int = 0
    max_runs: Optional[int] = None
    failure_count: int = 0
    next_run_at: Optional[str] = None
    expires_at: Optional[str] = None
    last_error: Optional[str] = None


class AdminDeviiTasksOut(_Out):
    items: list[AdminDeviiTaskItemOut] = []
    state: str = "active"
    tabs: list[dict] = []
    limits: dict = {}
    admin_section: Optional[str] = None


class AdminGameOut(_Out):
    era_active: bool = False
    era_name: str = ""
    era_number: int = 0
    era_started_at: str = ""
    era_ends_at: str = ""
    admin_section: Optional[str] = None
