using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace AxCopilot.Models;

public class LlmSettings
{
	[JsonPropertyName("service")]
	public string Service { get; set; } = "ollama";

	[JsonPropertyName("endpoint")]
	public string Endpoint { get; set; } = "http://localhost:11434";

	[JsonPropertyName("model")]
	public string Model { get; set; } = "";

	[JsonPropertyName("encryptedApiKey")]
	public string EncryptedApiKey { get; set; } = "";

	[JsonPropertyName("apiKey")]
	public string ApiKey { get; set; } = "";

	[JsonPropertyName("streaming")]
	public bool Streaming { get; set; } = true;

	[JsonPropertyName("maxContextTokens")]
	public int MaxContextTokens { get; set; } = 4096;

	[JsonPropertyName("retentionDays")]
	public int RetentionDays { get; set; } = 30;

	[JsonPropertyName("temperature")]
	public double Temperature { get; set; } = 0.7;

	[JsonPropertyName("registeredModels")]
	public List<RegisteredModel> RegisteredModels { get; set; } = new List<RegisteredModel>();

	[JsonPropertyName("encryptionEnabled")]
	public bool EncryptionEnabled { get; set; } = false;

	[JsonPropertyName("promptTemplates")]
	public List<PromptTemplate> PromptTemplates { get; set; } = new List<PromptTemplate>();

	[JsonPropertyName("workFolder")]
	public string WorkFolder { get; set; } = "";

	[JsonPropertyName("recentWorkFolders")]
	public List<string> RecentWorkFolders { get; set; } = new List<string>();

	[JsonPropertyName("maxRecentFolders")]
	public int MaxRecentFolders { get; set; } = 10;

	[JsonPropertyName("showFileBrowser")]
	public bool ShowFileBrowser { get; set; } = false;

	[JsonPropertyName("filePermission")]
	public string FilePermission { get; set; } = "Ask";

	[JsonPropertyName("defaultAgentPermission")]
	public string DefaultAgentPermission { get; set; } = "Ask";

	[JsonPropertyName("ollamaEndpoint")]
	public string OllamaEndpoint { get; set; } = "http://localhost:11434";

	[JsonPropertyName("ollamaApiKey")]
	public string OllamaApiKey { get; set; } = "";

	[JsonPropertyName("ollamaModel")]
	public string OllamaModel { get; set; } = "";

	[JsonPropertyName("vllmEndpoint")]
	public string VllmEndpoint { get; set; } = "";

	[JsonPropertyName("vllmApiKey")]
	public string VllmApiKey { get; set; } = "";

	[JsonPropertyName("vllmModel")]
	public string VllmModel { get; set; } = "";

	[JsonPropertyName("geminiApiKey")]
	public string GeminiApiKey { get; set; } = "";

	[JsonPropertyName("geminiModel")]
	public string GeminiModel { get; set; } = "gemini-2.5-flash";

	[JsonPropertyName("claudeApiKey")]
	public string ClaudeApiKey { get; set; } = "";

	[JsonPropertyName("claudeModel")]
	public string ClaudeModel { get; set; } = "claude-sonnet-4-6";

	[JsonPropertyName("defaultOutputFormat")]
	public string DefaultOutputFormat { get; set; } = "auto";

	[JsonPropertyName("defaultMood")]
	public string DefaultMood { get; set; } = "modern";

	[JsonPropertyName("autoPreview")]
	public string AutoPreview { get; set; } = "off";

	[JsonPropertyName("maxAgentIterations")]
	public int MaxAgentIterations { get; set; } = 25;

	[JsonPropertyName("maxRetryOnError")]
	public int MaxRetryOnError { get; set; } = 3;

	[JsonPropertyName("maxTestFixIterations")]
	public int MaxTestFixIterations { get; set; } = 5;

	[JsonPropertyName("agentLogLevel")]
	public string AgentLogLevel { get; set; } = "simple";

	[JsonPropertyName("enableParallelTools")]
	public bool EnableParallelTools { get; set; } = false;

	[JsonPropertyName("enableMultiPassDocument")]
	public bool EnableMultiPassDocument { get; set; } = false;

	[JsonPropertyName("enableCoworkVerification")]
	public bool EnableCoworkVerification { get; set; } = false;

	[JsonPropertyName("enableFilePathHighlight")]
	public bool EnableFilePathHighlight { get; set; } = true;

	[JsonPropertyName("multiPassThresholdPages")]
	public int MultiPassThresholdPages { get; set; } = 3;

	[JsonPropertyName("lastConversationIds")]
	public Dictionary<string, string> LastConversationIds { get; set; } = new Dictionary<string, string>();

	[JsonPropertyName("folderDataUsage")]
	public string FolderDataUsage { get; set; } = "active";

	[JsonPropertyName("agentDecisionLevel")]
	public string AgentDecisionLevel { get; set; } = "detailed";

	[JsonPropertyName("planMode")]
	public string PlanMode { get; set; } = "off";

	[JsonPropertyName("enableProjectRules")]
	public bool EnableProjectRules { get; set; } = true;

	[JsonPropertyName("fallbackModels")]
	public List<string> FallbackModels { get; set; } = new List<string>();

	[JsonPropertyName("maxSubAgents")]
	public int MaxSubAgents { get; set; } = 3;

	[JsonPropertyName("pdfExportPath")]
	public string PdfExportPath { get; set; } = "";

	[JsonPropertyName("enableAuditLog")]
	public bool EnableAuditLog { get; set; } = true;

	[JsonPropertyName("enableAgentMemory")]
	public bool EnableAgentMemory { get; set; } = true;

	[JsonPropertyName("maxMemoryEntries")]
	public int MaxMemoryEntries { get; set; } = 100;

	[JsonPropertyName("enableImageInput")]
	public bool EnableImageInput { get; set; } = true;

	[JsonPropertyName("maxImageSizeKb")]
	public int MaxImageSizeKb { get; set; } = 5120;

	[JsonPropertyName("enableAutoRouter")]
	public bool EnableAutoRouter { get; set; } = false;

	[JsonPropertyName("autoRouterConfidence")]
	public double AutoRouterConfidence { get; set; } = 0.7;

	[JsonPropertyName("modelCapabilities")]
	public List<ModelCapability> ModelCapabilities { get; set; } = new List<ModelCapability>();

	[JsonPropertyName("mcpServers")]
	public List<McpServerEntry> McpServers { get; set; } = new List<McpServerEntry>();

	[JsonPropertyName("enableChatRainbowGlow")]
	public bool EnableChatRainbowGlow { get; set; } = false;

	[JsonPropertyName("notifyOnComplete")]
	public bool NotifyOnComplete { get; set; } = false;

	[JsonPropertyName("showTips")]
	public bool ShowTips { get; set; } = false;

	[JsonPropertyName("tipDurationSeconds")]
	public int TipDurationSeconds { get; set; } = 5;

	[JsonPropertyName("devMode")]
	public bool DevMode { get; set; } = false;

	[JsonPropertyName("devModeStepApproval")]
	public bool DevModeStepApproval { get; set; } = false;

	[JsonPropertyName("workflowVisualizer")]
	public bool WorkflowVisualizer { get; set; } = false;

	[JsonPropertyName("freeTierMode")]
	public bool FreeTierMode { get; set; } = false;

	[JsonPropertyName("freeTierDelaySeconds")]
	public int FreeTierDelaySeconds { get; set; } = 4;

	[JsonPropertyName("showTotalCallStats")]
	public bool ShowTotalCallStats { get; set; } = false;

	[JsonPropertyName("blockedPaths")]
	public List<string> BlockedPaths { get; set; } = new List<string> { "*\\Windows\\*", "*\\Program Files\\*", "*\\Program Files (x86)\\*", "*\\System32\\*", "*\\AppData\\Local\\*", "*Documents*" };

	[JsonPropertyName("blockedExtensions")]
	public List<string> BlockedExtensions { get; set; } = new List<string> { ".exe", ".dll", ".sys", ".msi", ".reg", ".vbs", ".com", ".scr", ".pif" };

	[JsonPropertyName("customPresets")]
	public List<CustomPresetEntry> CustomPresets { get; set; } = new List<CustomPresetEntry>();

	[JsonPropertyName("customMoods")]
	public List<CustomMoodEntry> CustomMoods { get; set; } = new List<CustomMoodEntry>();

	[JsonPropertyName("disabledTools")]
	public List<string> DisabledTools { get; set; } = new List<string>();

	[JsonPropertyName("toolPermissions")]
	public Dictionary<string, string> ToolPermissions { get; set; } = new Dictionary<string, string>();

	[JsonPropertyName("enableToolHooks")]
	public bool EnableToolHooks { get; set; } = true;

	[JsonPropertyName("toolHookTimeoutMs")]
	public int ToolHookTimeoutMs { get; set; } = 10000;

	[JsonPropertyName("agentHooks")]
	public List<AgentHookEntry> AgentHooks { get; set; } = new List<AgentHookEntry>();

	[JsonPropertyName("enableSkillSystem")]
	public bool EnableSkillSystem { get; set; } = true;

	[JsonPropertyName("skillsFolderPath")]
	public string SkillsFolderPath { get; set; } = "";

	[JsonPropertyName("slashPopupPageSize")]
	public int SlashPopupPageSize { get; set; } = 7;

	[JsonPropertyName("favoriteSlashCommands")]
	public List<string> FavoriteSlashCommands { get; set; } = new List<string>();

	[JsonPropertyName("enableDragDropAiActions")]
	public bool EnableDragDropAiActions { get; set; } = true;

	[JsonPropertyName("dragDropAutoSend")]
	public bool DragDropAutoSend { get; set; } = false;

	[JsonPropertyName("code")]
	public CodeSettings Code { get; set; } = new CodeSettings();
}
