from kagan.database.models import TicketPriority, TicketStatus
from kagan.limits import (
    AGENT_TIMEOUT,
    AGENT_TIMEOUT_LONG,
    MESSAGE_BUFFER,
    RESPONSE_BUFFER,
    SCRATCHPAD_LIMIT,
    SHUTDOWN_TIMEOUT,
    SUBPROCESS_LIMIT,
    TICK_INTERVAL,
)

# UI Display Constants
# Card widget truncation lengths
CARD_TITLE_LINE_WIDTH = 24  # Chars per line for word-wrapped titles
CARD_DESC_MAX_LENGTH = 22
CARD_REVIEW_MAX_LENGTH = 18
CARD_HAT_MAX_LENGTH = 8
CARD_ID_MAX_LENGTH = 4
CARD_BACKEND_MAX_LENGTH = 6

# Modal title truncation lengths
MODAL_TITLE_MAX_LENGTH = 50
APPROVAL_TITLE_MAX_LENGTH = 45
NOTIFICATION_TITLE_MAX_LENGTH = 40
PLANNER_TITLE_MAX_LENGTH = 30

# Diff/content limits
DIFF_MAX_LENGTH = 10000

# Screen size minimums
MIN_SCREEN_WIDTH = 80
MIN_SCREEN_HEIGHT = 20

# Files/directories generated by Kagan that should be gitignored
# Used by MCP tools to exclude from "uncommitted changes" check
# and by setup/session code to ensure proper .gitignore entries
#
# Note: MCP config files (.mcp.json for Claude, opencode.json for OpenCode)
# are added dynamically based on the agent being used.
KAGAN_GENERATED_PATTERNS = (
    ".kagan/",
    ".mcp.json",  # Claude Code MCP config (may be merged with existing)
    "opencode.json",  # OpenCode MCP config (may be merged with existing)
)

DEFAULT_DB_PATH = ".kagan/state.db"
DEFAULT_CONFIG_PATH = ".kagan/config.toml"
DEFAULT_LOCK_PATH = ".kagan/kagan.lock"

COLUMN_ORDER = [
    TicketStatus.BACKLOG,
    TicketStatus.IN_PROGRESS,
    TicketStatus.REVIEW,
    TicketStatus.DONE,
]

STATUS_LABELS = {
    TicketStatus.BACKLOG: "BACKLOG",
    TicketStatus.IN_PROGRESS: "IN PROGRESS",
    TicketStatus.REVIEW: "REVIEW",
    TicketStatus.DONE: "DONE",
}

PRIORITY_LABELS = {
    TicketPriority.LOW: "Low",
    TicketPriority.MEDIUM: "Medium",
    TicketPriority.HIGH: "High",
}

# Box Drawing Characters
BOX_DRAWING = {
    "THICK_TL": "┏",
    "THICK_TR": "┓",
    "THICK_BL": "┗",
    "THICK_BR": "┛",
    "THICK_H": "━",
    "THICK_V": "┃",
    "THIN_TL": "┌",
    "THIN_TR": "┐",
    "THIN_BL": "└",
    "THIN_BR": "┘",
    "THIN_H": "─",
    "THIN_V": "│",
    "LIGHT_H": "─",
    "HEAVY_H": "═",
    "BULLET": "•",  # Simple bullet that renders everywhere
    "DOT": "∙",
    "ARROW_RIGHT": "→",
    "ARROW_DOWN": "↓",
    "SECTION": "─",
    "DIVIDER_LIGHT": "─",
    "DIVIDER_HEAVY": "═",
}

__all__ = [
    "AGENT_TIMEOUT",
    "AGENT_TIMEOUT_LONG",
    "APPROVAL_TITLE_MAX_LENGTH",
    "BOX_DRAWING",
    "CARD_BACKEND_MAX_LENGTH",
    "CARD_DESC_MAX_LENGTH",
    "CARD_HAT_MAX_LENGTH",
    "CARD_ID_MAX_LENGTH",
    "CARD_REVIEW_MAX_LENGTH",
    "CARD_TITLE_LINE_WIDTH",
    "COLUMN_ORDER",
    "DEFAULT_CONFIG_PATH",
    "DEFAULT_DB_PATH",
    "DEFAULT_LOCK_PATH",
    "DIFF_MAX_LENGTH",
    "KAGAN_GENERATED_PATTERNS",
    "MESSAGE_BUFFER",
    "MIN_SCREEN_HEIGHT",
    "MIN_SCREEN_WIDTH",
    "MODAL_TITLE_MAX_LENGTH",
    "NOTIFICATION_TITLE_MAX_LENGTH",
    "PLANNER_TITLE_MAX_LENGTH",
    "PRIORITY_LABELS",
    "RESPONSE_BUFFER",
    "SCRATCHPAD_LIMIT",
    "SHUTDOWN_TIMEOUT",
    "STATUS_LABELS",
    "SUBPROCESS_LIMIT",
    "TICK_INTERVAL",
]
