from toad.settings import SchemaDict

SCHEMA: list[SchemaDict] = [
    {
        "key": "ui",
        "title": "User interface settings",
        "help": "The following settings allow you to customize the look and feel of the User Interface.",
        "type": "object",
        "fields": [
            {
                "key": "theme",
                "title": "Theme",
                "help": "One of the builtin Textual themes.",
                "type": "choices",
                "default": "dracula",
                "choices": [
                    "atom-one-dark",
                    "atom-one-light",
                    "catppuccin-latte",
                    "catppuccin-mocha",
                    "dracula",
                    "flexoki",
                    "gruvbox",
                    "monokai",
                    "nord",
                    "solarized-light",
                    "solarized-dark",
                    "textual-dark",
                    "textual-light",
                    "tokyo-night",
                    "rose-pine",
                    "rose-pine-moon",
                    "rose-pine-dawn",
                ],
            },
            {
                "key": "compact-input",
                "title": "Compact text input?",
                "help": "Remove border and margin around the text area for additional space",
                "type": "boolean",
                "default": False,
            },
            {
                "key": "footer",
                "title": "Enable footer?",
                "help": "Disable the footer if you want additional room.",
                "type": "boolean",
                "default": True,
            },
            {
                "key": "info-bar",
                "title": "Enable info bar?",
                "help": "The info bar is the text below the prompt text area. Disable for more space.",
                "type": "boolean",
                "default": True,
            },
            {
                "key": "status-line",
                "title": "Show status line in the info bar?",
                "help": "The status line shows tokens and cost (not available in all agents).",
                "type": "boolean",
                "default": True,
            },
            {
                "key": "agent-title",
                "title": "Show agent title the info bar?",
                "help": "Disable for a little extras space.",
                "type": "boolean",
                "default": True,
            },
            {
                "key": "column",
                "title": "Enable column?",
                "help": "Enable for a fixed column size. Disable to use the full screen width.",
                "type": "boolean",
                "default": True,
            },
            {
                "key": "column-width",
                "title": "Width of the column",
                "help": "Width of the column if enabled. Minimum 40 characters.",
                "type": "integer",
                "default": 100,
                "validate": [{"type": "minimum", "value": 40}],
            },
            {
                "key": "scrollbar",
                "title": "Scrollbar size",
                "type": "choices",
                "default": "normal",
                "choices": [
                    ("Normal", "normal"),
                    ("Thin", "thin"),
                    ("Hidden", "hidden"),
                ],
            },
            {
                "key": "throbber",
                "title": "Thinking animation",
                "help": "Animation to show while waiting for the agent to respond",
                "type": "choices",
                "default": "quotes",
                "choices": [
                    ("Pulse", "pulse"),
                    ("Quotes", "quotes"),
                ],
            },
            {
                "key": "flash_duration",
                "title": "Flash duration",
                "help": "Default duration of flash messages (in seconds)",
                "type": "number",
                "default": 3.0,
                "validate": [{"type": "minimum", "value": 0.5}],
            },
            {
                "key": "auto_copy",
                "title": "Automatic copy",
                "help": "Automatically copy text on selection?\nDoesn't apply to text areas (use ctrl+c to copy).",
                "type": "boolean",
                "default": True,
            },
            {
                "key": "prune_low_mark",
                "title": "Target lines",
                "help": "Keep at least this many number of lines of conversation (minimum 100).",
                "type": "integer",
                "default": 1500,
                "validate": [{"type": "minimum", "value": 100}],
            },
            {
                "key": "prune_excess",
                "title": "Additional lines",
                "help": "Start removing lines when the conversation has this number of lines more than the target (see 'Target lines').",
                "type": "integer",
                "default": 1000,
                "validate": [{"type": "minimum", "value": 0}],
            },
        ],
    },
    {
        "key": "notifications",
        "title": "Notification (toasts) settings",
        "help": "Customize how Toad displays notifications",
        "type": "object",
        "fields": [
            {
                "key": "system",
                "title": "Show Toad notifications on your desktop?",
                "type": "choices",
                "default": "blur",
                "choices": [
                    ("Never", "never"),
                    ("When app is not focused", "blur"),
                    ("Always", "always"),
                ],
            },
            {
                "key": "blink_title",
                "title": "Blink terminal title when input is required?",
                "type": "boolean",
                "default": True,
            },
            {
                "key": "enable_sounds",
                "title": "Allow sound in notifications?",
                "type": "boolean",
                "default": True,
            },
            {
                "key": "turn_over",
                "title": "Desktop notification when agent has finished?",
                "type": "boolean",
                "default": True,
            },
            {
                "key": "hide_low_severity",
                "title": "Limit desktop notifications to warning and errors?",
                "type": "boolean",
                "default": True,
            },
        ],
    },
    {
        "key": "sidebar",
        "title": "Sidebar settings",
        "help": "Customize how the sidebar is displayed.",
        "type": "object",
        "fields": [
            {
                "key": "hide",
                "title": "Hide the sidebar when not in use?",
                "type": "boolean",
                "default": False,
            }
        ],
    },
    {
        "key": "agent",
        "title": "Agent settings",
        "help": "Customize how you interact with agents",
        "type": "object",
        "fields": [
            {
                "key": "thoughts",
                "title": "Agent thoughts",
                "help": "Show agent's 'thoughts' in the conversation?",
                "type": "boolean",
            },
            # {
            #     "key": "warn",
            #     "title": "Warning against dangerous commands?",
            #     "help": "Please note that this can produce false positive [i]and[/i] false negatives. If you get a warning, examine the command more closely. But do not assume a command is safe if you get no warning.\n\nThis setting will have no effect if you have given the agent permissions to execute all commands.",
            #     "type": "boolean",
            #     "default": True,
            # },
        ],
    },
    {
        "key": "tools",
        "title": "Tool call settings",
        "help": "Customize how Toad displays agent tool calls",
        "type": "object",
        "fields": [
            {
                "key": "expand",
                "title": "Tool call expand",
                "help": "When should Toad expand tool calls?",
                "type": "choices",
                "default": "fail",
                "choices": [
                    ("Never", "never"),
                    ("Always", "always"),
                    ("Success only", "success"),
                    ("Fail only", "fail"),
                    ("Fail and success", "both"),
                ],
            }
        ],
    },
    {
        "key": "shell",
        "title": "Shell settings",
        "help": "Customize shell interactions.",
        "type": "object",
        "fields": [
            {
                "key": "command",
                "title": "Shell command",
                "type": "string",
                "help": "Command used to launch your shell on macOS.\n[bold]Note:[/] Requires restart.",
                "default": "/bin/sh",
            },
            {
                "key": "command_start",
                "title": "Startup commands",
                "type": "text",
                "help": "Command(s) to run on shell start.",
                "default": 'PS1=""',
            },
            {
                "key": "warn_dangerous",
                "title": "Warn against potentially destructive commands?",
                "help": "If enabled, Toad will highlight potentially destructive commands that may modify the filesystem outside of the project directory.\n\nNote that false positive [i]and[/] false negatives are possible.",
                "type": "boolean",
                "default": True,
            },
            {
                "key": "allow_commands",
                "title": "Allow commands",
                "help": "List of commands (one per line) which should be considered shell commands by default, rather than a part of a prompt.",
                "type": "text",
                "default": "python\ngit\nls\ncat\ncd\nmv\ncp\ntree\nrm\necho\nrmdir\nmkdir\ntouch\nopen\npwd\nnano",
            },
            {
                "key": "directory_commands",
                "title": "Directory commands",
                "help": "List of commands (one per line) which accept only a directory as their first argument (used in tab completion).",
                "type": "text",
                "default": "cd\nrmdir",
            },
            {
                "key": "file_commands",
                "title": "File commands",
                "help": "List of commands (one per line) which accept only a non-directory as their first argument (used in tab completion).",
                "type": "text",
                "default": "cat",
            },
        ],
    },
    {
        "key": "diff",
        "title": "Diff view settings",
        "help": "Customize how diffs are displayed.",
        "type": "object",
        "fields": [
            {
                "key": "view",
                "title": "Display preference",
                "default": "auto",
                "type": "choices",
                "choices": [
                    ("Unified", "unified"),
                    ("Split", "split"),
                    ("Best fit", "auto"),
                ],
            }
        ],
    },
    {
        "key": "launcher",
        "title": "Launcher settings",
        "help": "Customize the launcher",
        "type": "object",
        "editable": False,
        "fields": [
            {
                "key": "agents",
                "title": "Agents to show in the launcher",
                "type": "text",
                "default": "",
            }
        ],
    },
    {
        "key": "statistics",
        "title": "Data collection",
        "help": "Preferences regarding data collection.",
        "type": "object",
        "fields": [
            {
                "key": "allow_collect",
                "title": "Allow collection of anonymous usage data?",
                "help": "Toad can collect basic usage data (number of installs, OS version, agents used, session length etc). This information is associated with a randomly generated UUID (see it in /about:toad) and contains no personal information.\n\nCollecting this information will help me (Will McGugan) convince big tech to take this project seriously. I would appreciate if you left this on, but it is entirely up to you.",
                "type": "boolean",
                "default": True,
            },
        ],
    },
]
