# retoor <retoor@molodetz.nl>

from __future__ import annotations

from typing import Optional

from devplacepy.schemas.base import _Out


class ZipJobOut(_Out):
    uid: str = ""
    kind: str = ""
    status: str = ""
    preferred_name: Optional[str] = None
    download_url: Optional[str] = None
    error: Optional[str] = None
    bytes_in: int = 0
    bytes_out: int = 0
    item_count: int = 0
    file_count: int = 0
    dir_count: int = 0
    created_at: Optional[str] = None
    completed_at: Optional[str] = None


class PlanningJobOut(_Out):
    uid: str = ""
    kind: str = ""
    status: str = ""
    preferred_name: Optional[str] = None
    download_url: Optional[str] = None
    markdown: Optional[str] = None
    ai_used: bool = False
    error: Optional[str] = None
    issue_count: int = 0
    bytes_out: int = 0
    created_at: Optional[str] = None
    completed_at: Optional[str] = None


class ForkJobOut(_Out):
    uid: str = ""
    kind: str = ""
    status: str = ""
    preferred_name: Optional[str] = None
    project_uid: Optional[str] = None
    project_url: Optional[str] = None
    source_project_uid: Optional[str] = None
    error: Optional[str] = None
    item_count: int = 0
    created_at: Optional[str] = None
    completed_at: Optional[str] = None


class SeoJobOut(_Out):
    uid: str = ""
    kind: str = ""
    status: str = ""
    target: Optional[str] = None
    mode: Optional[str] = None
    ws_url: Optional[str] = None
    report_url: Optional[str] = None
    score: Optional[int] = None
    grade: Optional[str] = None
    page_count: int = 0
    error: Optional[str] = None
    created_at: Optional[str] = None
    completed_at: Optional[str] = None


class SeoReportOut(_Out):
    uid: str = ""
    status: str = ""
    target: Optional[str] = None
    mode: Optional[str] = None
    score: Optional[int] = None
    grade: Optional[str] = None
    page_count: int = 0
    counts: dict = {}
    categories: dict = {}
    pages: list = []
    checks: list = []
    site: dict = {}
    generated_at: Optional[str] = None


class SeoMetaOut(_Out):
    uid: str = ""
    target_type: str = ""
    target_uid: str = ""
    seo_title: str = ""
    seo_description: str = ""
    seo_keywords: str = ""
    status: str = ""
    source: str = ""
    generated_at: Optional[str] = None


class DeepsearchJobOut(_Out):
    uid: str = ""
    kind: str = ""
    status: str = ""
    query: Optional[str] = None
    depth: int = 0
    max_pages: int = 0
    ws_url: Optional[str] = None
    chat_ws_url: Optional[str] = None
    session_url: Optional[str] = None
    score: Optional[int] = None
    confidence: Optional[float] = None
    source_diversity: Optional[float] = None
    page_count: int = 0
    chunk_count: int = 0
    error: Optional[str] = None
    created_at: Optional[str] = None
    completed_at: Optional[str] = None


class DeepsearchSessionOut(_Out):
    uid: str = ""
    status: str = ""
    query: Optional[str] = None
    depth: int = 0
    max_pages: int = 0
    score: Optional[int] = None
    confidence: Optional[float] = None
    source_diversity: Optional[float] = None
    synthesis: str = ""
    page_count: int = 0
    chunk_count: int = 0
    summary: Optional[str] = None
    sources: list = []
    findings: list = []
    timeline: list = []
    follow_up_questions: list = []
    chat_ws_url: Optional[str] = None
    export_md_url: Optional[str] = None
    export_json_url: Optional[str] = None
    export_pdf_url: Optional[str] = None
    viewer_is_admin: bool = False
    viewer_owns: bool = False
    created_at: Optional[str] = None
    completed_at: Optional[str] = None


class DbQueryJobOut(_Out):
    uid: str = ""
    kind: str = ""
    status: str = ""
    ws_url: Optional[str] = None
    result_url: Optional[str] = None
    row_count: Optional[int] = None
    truncated: Optional[bool] = None
    error: Optional[str] = None
    created_at: Optional[str] = None
    completed_at: Optional[str] = None


class IsslopAnalysisOut(_Out):
    uid: str = ""
    status: str = ""
    source_url: str = ""
    source_kind: str = ""
    grade: Optional[str] = None
    slop_score: Optional[float] = None
    origin_score: Optional[float] = None
    quality_deficit_score: Optional[float] = None
    human_percent: Optional[float] = None
    ai_percent: Optional[float] = None
    category: Optional[str] = None
    confidence: Optional[str] = None
    files_total: int = 0
    files_analyzed: int = 0
    detected_builder: Optional[str] = None
    dom_slop_score: Optional[float] = None
    error: Optional[str] = None
    report_url: Optional[str] = None
    badge_url: Optional[str] = None
    events_url: Optional[str] = None
    topic: Optional[str] = None
    created_at: Optional[str] = None
    finished_at: Optional[str] = None


class IsslopListOut(_Out):
    analyses: list = []


class IsslopReportOut(_Out):
    uid: str = ""
    status: str = ""
    source_url: str = ""
    source_kind: str = ""
    grade: Optional[str] = None
    slop_score: Optional[float] = None
    origin_score: Optional[float] = None
    quality_deficit_score: Optional[float] = None
    human_percent: Optional[float] = None
    ai_percent: Optional[float] = None
    category: Optional[str] = None
    confidence: Optional[str] = None
    files_total: int = 0
    files_analyzed: int = 0
    detected_builder: Optional[str] = None
    dom_slop_score: Optional[float] = None
    error: Optional[str] = None
    report_url: Optional[str] = None
    badge_url: Optional[str] = None
    events_url: Optional[str] = None
    topic: Optional[str] = None
    content_hash: Optional[str] = None
    markdown: str = ""
    generator_model: str = ""
    generated_at: Optional[str] = None
    badge: dict = {}
    files: list = []
    images: list = []
    dom_pages: list = []
    created_at: Optional[str] = None
    finished_at: Optional[str] = None


class IsslopSourceOut(_Out):
    uid: str = ""
    path: str = ""
    language: str = ""
    category: str = ""
    origin_score: float = 0.0
    quality_deficit_score: float = 0.0
    source: str = ""
    truncated: bool = False
    signals: list = []
    source_lines: list = []
    marked_lines: dict = {}
    focus_line: int = 0
    report_url: Optional[str] = None
