class InfoLogs:
    FETCHED_TABLES_FROM_FOLDER = "Successfully fetched {count} semantic models from folder: {folder}."
    FETCHED_COLUMNS = "Successfully fetched columns for semantic model: {table_name} columns: {columns}"
    QUERY_RETRYING = "Retrying to build a new query..."
    QUERY_EXECUTING = "Executing query: {query}"
    QUERY_SUCCESS = "Query executed successfully."
    FETCHING_TABLES = "Fetching semantic models from folder: {folder}."
    FETCHING_COLUMNS = "Fetching columns for semantic model: {table_name} in folder: {folder}."
    KYVOS_AUTH_METHOD = "Using Kyvos authentication method."
    KYVOS_URL_NOT_SET = "KYVOS_URL not set; skipping Kyvos setup."
    MCP_KYVOS_SERVER_STARTED = "Starting MCP Kyvos server."
    MCP_KYVOS_SERVER_SHUTDOWN = "Shutting down MCP Kyvos server."
    TABLES_ADDED = "Added {count} Kyvos semantic models to resources."
    RECEIVED_JSON = "Received JSON:"
    SERVER_STARTED = "MCP Kyvos Server Started."
    INIT_MCP_SERVER = "MCP Kyvos Server [Version {version}]"
    LOG_FILE_CREATED = "Log file for MCP Kyvos Server created at: {log_path}"
    DATABASE_CREATED = "Database for storing user access tokens initialized at: {DB_PATH}"
    KYVOS_URL_SET = "KYVOS_URL environment variable set successfully"
    KYVOS_USERNAME_SET = "KYVOS_USERNAME environment variable set successfully"
    KYVOS_PASSWORD_SET = "KYVOS_PASSWORD environment variable set successfully"
    VERIFY_SSL_SET = "VERIFY_SSL environment variable set successfully"
    KYVOS_PROMPT_FILE_SET = "KYVOS_PROMPT_FILE environment variable set successfully"
    KYVOS_MAX_ROWS = "KYVOS_MAX_ROWS set to {max_rows}"
    STARTING_SERVER = "Starting MCP Kyvos Server."
    PROMPT_FILE_LOADED_DEFAULT = "Loaded prompt file from default project path."
    PROMPT_FILE_LOADED_ENV = "Loaded prompt file from user-defined path via environment variable."
    SSL_CERTIFICATE_FILE = "Path to the SSL certificate file"
    SSL_KEY_FILE = "Path to the SSL private key file"
    KYVOS_DEFAULT_FOLDER = "Folder which contains multiple sementic models"
    KYVOS_VERSION = "Version which kyvos server is running"
    PORT_LOGS = "MCP Kyvos Server is running on port {port}."
    MCP_SERVER_URL_LOGS = "MCP Kyvos Server is running on following address {address}."
    KYVOS_API_REQUEST_URL = "[{tool}] Request URL: {url}"
    KYVOS_API_REQUEST_PAYLOAD = "[{tool}] Request Payload: {payload}"
    KYVOS_API_RESPONSE = "[{tool}] Response Received: {response}"
    REFRESHING_ACCESS_TOKEN = "Access token has expired. Refreshing the access token..."
    UPDATED_MESSAGE_WITH_TOKEN_BASIC = "Updated message instance with access token in JSONRPCMessage for SSE Basic Auth."
    UPDATED_MESSAGE_WITH_TOKEN_OAUTH = "Updated message instance with access token in JSONRPCMessage for SSE OAuth."
    ACCESS_TOKEN_VALIDATED = "Access token has been successfully validated and is active."
    INVALID_TOKEN_MESSAGE = "Invalid token. Unauthorized access. Please log in via the authorization server."
    RAW_DATA_QUERY_FLAG = "Raw data query access is set to: {raw_data_query}"
    CLIENT_REDIRECTING_TO_AUTH_URL = "Redirecting client to authorization URL."
    CLIENT_REDIRECTING_TO_CALLBACK = "Redirecting to client callback URL with bound code."
    TOKEN_DETAILS_UPDATED_IN_DB = "Updated token details in database."
    GENERATING_CLIENT_ACCESS_TOKEN = "Generating access token for MCP Client."
    CLIENT_ACCESS_TOKEN_EXPIRED = "Client access token expired."
    CLIENT_REFRESH_TOKEN_FLOW_STARTED = "Processing refresh token to obtain new client access token."
    BOUND_CODE_PROCESSING_STARTED = "Processing the bound authorization code to generate client access token."
    OAUTH_FLOW_SUCCESS = "OAuth flow completed successfully: Client access token issued and sent to the client."
    KYVOS_RESPONSE_SERVED_FROM_CACHE = "Kyvos API response served from cache."
    KYVOS_RESPONSE_FETCHED_AND_CACHED = "Fetched fresh data from Kyvos API response and cached it."
    OPENID_CONFIG_FETCHED = "Well-known API executed successfully and fetched OpenID configuration."
    CLIENT_REGISTERED_SUCCESS = "Client '{client_name}' registered successfully."
    ACCESS_TOKEN_RECEIVED = "Received access token from authorization server."
    BOUND_CODE_GENERATED = "Bound authorization code successfully generated for client's access token exchange."
    CLIENT_REFRESH_TOKEN_RECEIVED = "Received client's refresh token."
    CLIENT_ACCESS_TOKEN_GENERATED = "New client access token successfully generated and updated in database."
    CLIENT_ACCESS_TOKEN_FETCHED_FROM_DB = "Client access token successfully fetched from database."
    REFRESH_TOKEN_FETCHED_FROM_DB = "Refresh token successfully fetched from database."

class WarningLogs:
    KYVOS_CONFIG_INCOMPLETE = "Kyvos configuration incomplete despite KYVOS_URL being present."
    FAILED_TO_ADD_AUTH_TOKEN = "Failed to add auth token to message."
    NO_SESSION_FOR_ID = "Could not find session for ID: {session_id}"
    RECEIVED_INVALID_SESSION_ID = "Received invalid session ID: {session_id}"
    RECEIVED_REQUEST_WITHOUT_SESSION_ID = "Received request without session_id."
    MISSING_PARAMS_FIELD = "No 'params' found or it's not a dict."
    MISSING_ROOT_FIELD = "No 'root' found in message."
    MISSING_OR_MALFORMED_AUTH_HEADER = "Missing or malformed Authorization header"
    INVALID_TOKEN_MESSAGE = "Invalid token. Unauthorized access. Please log in via the authorization server."
    EMAIL_EXTRACTION_FAILED = "Could not extract email from access token."
    ACCESS_TOKEN_RETRIEVAL_FAILED = "Failed to retrieve access token for email: {email}"
    TOKEN_EXCHANGE_WARNING = "Token exchange warning: {description}"
    CLIENT_NOT_REGISTERED = "Client didn't register via register endpoint. Received client callback URL through authorize params."

class DebugLogs:
    KYVOS_CLIENT_INITIALIZED = "Initialized Kyvos client with URL: {url}"
    SENDING_MESSAGE = "Sending message to writer: {message}"
    VALIDATED_CLIENT_MESSAGE = "Validated client message: {message}"
    PARSED_SESSION_ID = "Parsed session ID: {session_id}."
    LOADING_ENV_FROM_FILE = "Loading environment from file: {env_file}"
    LOADING_DEFAULT_ENV = "Attempting to load environment from default .env file"
    KYVOS_FETCHER_INITIALIZED = "Initialized Kyvos fetcher"
    TABLE_MATCHED_WITH_FLAG = "Found matching semantic model: {table_name} with ALLOW_RAW_DATA_QUERY={value}"
    RAW_QUERY_PERMISSION_SET = "Raw data query permission for semantic model '{table_name}' set to: {raw_data_query}"
    RAW_QUERY_UNEXPECTED_VALUE = "Unexpected value for ALLOW_RAW_DATA_QUERY: {value}. Defaulting to False."
    RAW_QUERY_DEFAULT_VALUE = "ALLOW_RAW_DATA_QUERY value defaulting to False."
    USING_FLEXIBLE_PROMPT = "Using flexible system prompt: {path}"
    USING_STANDARD_PROMPT = "Using standard system prompt: {path}"
    SERVICE_INIT_ERROR_RERAISED = "ServiceInitializationError encountered. Re-raising after prior logging."
    RAW_REQUEST_BODY = "Received raw request body from MCP client: {body}"
    PARSED_JSONRPC_MESSAGE = "Successfully parsed JSON-RPC message: {message}"
    CHECKING_RAW_QUERY_PERMISSION = "Checking raw data query permission for semantic model: {}"
    ALL_TABLES_NONE = "'all_semantic_models' is None. Skipping raw data query check for semantic model '{}'."
    ALL_TABLES_NOT_LIST = "'all_semantic_models' is not a list. Skipping raw data query check for semantic model '{}'."
    ALL_TABLES_EMPTY = "'all_semantic_models' is an empty list. No semantic models to check for '{}'."
    SERVER_ACCESS_TOKEN_GENERATED = "New server access token successfully generated and updated in database."

class ErrorLogs:
    INVALID_KYVOS_CONFIG = "Invalid Kyvos configuration: {error}"
    UNEXPECTED_KYVOS_ERROR = "Unexpected error initializing Kyvos client: {error}"
    HTTP_ERROR_FETCHING_TABLES = "HTTP error while fetching semantic models from {url}: {error}"
    NETWORK_CONNECTION_ERROR = "Failed to establish a network connection to the Kyvos API at: {url}. Verify the URL and network connectivity. {error}"
    UNEXPECTED_ERROR_LISTING_TABLES = "Unexpected error while listing semantic models from Kyvos."
    NETWORK_ERROR_LISTING_TABLES = "Network error while listing semantic models: {error}"
    HTTP_ERROR_COLUMNS = "HTTP error while fetching columns for semantic model '{table_name}': {error}"
    NETWORK_ERROR_COLUMNS = "Network error while accessing Kyvos API for semantic model '{table_name}': {error}"
    UNEXPECTED_ERROR_COLUMNS = "Unexpected error while listing columns for semantic model '{table_name}': {error}"
    SQL_ERROR_WITH_RESPONSE = "Sql Error: '{response}' for query '{query}', fix the SQL query for the error"
    QUERY_EXECUTION_FAILED = "Query execution failed: the query is incorrect."
    HTTP_ERROR_EXECUTING_QUERY = "HTTP error executing query '{query}': {error}"
    NETWORK_ERROR_EXECUTING_QUERY = "Network error executing query '{query}': {error}"
    UNEXPECTED_ERROR_EXECUTING_QUERY = "Unexpected error executing query '{query}': {error}"
    CLIENT_ERROR_LOG = "Client Error: {response_text}."
    CLIENT_ERROR_EXCEPTION = "Client error '{error_message}' for url '{url}'"
    KYVOS_FETCHER_INITIALIZATION_FAILED = "Failed to initialize KyvosFetcher."
    READ_ONLY_MODE_DETERMINE_FAILED = "Failed to determine read-only mode."
    KYVOS_BASE_URL_FETCH_FAILED = "Failed to fetch Kyvos base URL."
    UNEXPECTED_SERVER_STARTUP_ERROR = "Unexpected error during server startup."
    TABLE_FETCHING_ERROR = "Error fetching Kyvos semantic models: {error_message}"
    KYVOS_CONTEXT_MISSING = "Kyvos context is missing. Cannot list Kyvos semantic models."
    MISSING_KYVOS_CONTEXT = "Missing Kyvos context for tool registration."
    ERROR_ADDING_TOOLS = "Error adding Kyvos tools: {error_message}"
    SERVER_ERROR = "Error while running the server: {error_message}"
    FAILED_TO_PARSE_MESSAGE = "Failed to parse message: {error_message}"
    TOOL_EXECUTION_ERROR = "Tool execution error: {error}"
    MISSING_ARGUMENT = "Missing required argument: {error}"
    INVALID_KYVOS_ENV_INPUT = "Invalid input provided for Kyvos environment variables: {error}"
    UNEXPECTED_KYVOS_ENV_ERROR = "Unexpected error while setting Kyvos environment variables: {error}"
    STARTUP_FATAL_ERROR = "Fatal error in MCP Kyvos startup: {error}"
    MISSING_URL = "Missing required KYVOS_URL environment variable"
    MISSING_USERNAME = "Missing required KYVOS_USERNAME environment variable"
    MISSING_PASSWORD = "Missing required KYVOS_PASSWORD environment variable"
    TOKEN_EXCHANGE_FAILED = "Token exchange failed [status_code={status_code}] message={message}"
    TOKEN_EXCHANGE_NETWORK_ERROR = "Network error during token exchange: {exception}"
    TOKEN_RESPONSE_PARSING_FAILED = "Error parsing token failure response: {parse_error}"
    TOKEN_REFRESH_FAILED = "Token refresh failed: {exception}"
    AUTH_CODE_MISSING = "Authorization code missing in callback."
    STATE_PARAM_MISSING = "State parameter missing; cannot identify database."
    CODE_VERIFIER_MISSING = "Code verifier missing from database."
    TOKEN_EXCHANGE_OR_BOUND_TOKEN_ERROR = "Error during token exchange or bound token generation: {exception}"
    CODE_PARAM_MISSING = "Missing 'code' parameter in request."
    OPENID_CONFIG_FETCH_ERROR = "Error fetching OpenID configuration: {exception}"
    ACCESS_TOKEN_MISSING_IN_RESPONSE = "Access token missing in token response."
    REFRESH_TOKEN_INVALID_OR_EXPIRED = "The refresh token is invalid or expired."
    BOUND_AUTH_CODE_INVALID_OR_EXPIRED = "Invalid or expired bound authorization code."

class ExceptionMessages:
    INVALID_CONFIG_EXCEPTION = "Invalid Kyvos configuration. Check your environment variables or config input."
    INIT_CLIENT_EXCEPTION = "Failed to initialize Kyvos client due to an unexpected error."
    HTTP_ERROR_FETCHING_TABLES = "HTTP error while fetching semantic models: {error_message}"
    NETWORK_CONNECTION_ERROR = "Failed to connect to the Kyvos API. Please check your network connection or verify the URL."
    UNEXPECTED_ERROR_LISTING_TABLES = "Unexpected error during Kyvos list_semantic_models call."
    NETWORK_ERROR_LISTING_TABLES = "Network error while listing semantic models."
    HTTP_ERROR_COLUMNS = "HTTP error while fetching column metadata: {details}"
    NETWORK_ERROR_COLUMNS = "Failed to connect to Kyvos API for column metadata."
    UNEXPECTED_ERROR_COLUMNS = "Unexpected error during Kyvos list_semantic_model_columns call."
    HTTP_STATUS_ERROR = "SQL execution failed with status code {code}: {text}"
    NETWORK_ERROR = "Network error while executing SQL query on Kyvos."
    UNEXPECTED_ERROR = "Unexpected error occurred while executing the SQL query."
    KYVOS_URL_MISSING = "Invalid or missing KYVOS_URL environment variable: {error}"
    KYVOS_URL_READ_ERROR = "Unexpected error while reading KYVOS_URL: {error}"
    FAILED_ENV_LOAD = "Failed to load environment variables."
    START_SERVER_FAILED = "Failed to start server."

class KyvosEndpoints:
    ENTITY_SEARCH = "/rest/entitySearch?version={version}"
    FOLDER_MODELS = "/rest/smodels/folder/{folder}?queryableModelsOnly=true&version={version}"
    SQL_METADATA = "/rest/smodels/sqlMetadata?version={version}"
    EXPORT_QUERY = "/rest/export/query?version={version}"

class HeaderKeys:
    ACCEPT = "Accept"
    CONTENT_TYPE = "Content-Type"
    AUTHORIZATION = "Authorization"

class EnvironmentVariables:
    KYVOS_DEFAULT_FOLDER = "KYVOS_DEFAULT_FOLDER"
    VERIFY_SSL = "VERIFY_SSL"
    KYVOS_URL = "KYVOS_URL"
    KYVOS_USERNAME = "KYVOS_USERNAME"
    KYVOS_PASSWORD = "KYVOS_PASSWORD"
    TRANSPORT = "TRANSPORT"
    PORT = "PORT"
    KYVOS_PROMPT_FILE = "KYVOS_PROMPT_FILE"
    MAX_ROWS ="MAX_ROWS"
    SSL_CERTIFICATE_FILE= "SSL_CERTIFILE"
    SSL_KEY_FILE="SSL_KEYFILE"
    KYVOS_VERSION="VERSION"
    SERVER_AUTH_TYPE="AUTH_TYPE"
    MCP_SERVER_URL="MCP_SERVER_URL"
    IS_FOLDERNAME_REQUIRED="IS_FOLDERNAME_REQUIRED"

class Descriptions:
    KYVOS_USERNAME_DESCRIPTION = "The Kyvos account username used to authenticate and log in to the Kyvos application."
    KYVOS_PASSWORD_DESCRIPTION = "The corresponding password for the provided KYVOS_USERNAME, used for authentication with the Kyvos application."
    KYVOS_URL_DESCRIPTION = "The base URL of the Kyvos server instance. This should point to the Kyvos REST API endpoint that the application will interact with."
    KYVOS_PROMPT_FILE_DESCRIPTION = "The file path to the .txt file that contains the prompt used to guide the large language model (LLM) for SPARK SQL generation."
    TRANSPORT_DESCRIPTION = "The type of communication transport to use. Valid options include stdio (standard input/output) and sse (Server-Sent Events)."
    KYVOS_DEFAULT_FOLDER_DESCRIPTION = "Folder containing multiple semantic models used for querying."
    OPENAI_API_KEY_DESCRIPTION = "The API key used to authenticate requests to OpenAI services. This key enables access to the language model for query interpretation and processing."
    VERIFY_SSL_DESCRIPTION = "A flag that determines whether SSL certificates should be verified when making HTTP requests to Kyvos. Set this to true to enforce SSL verification, or false to disable it (e.g., when using self-signed certificates in development environments)."
    ENV_FILE_DESCRIPTION = "The path to a `.env` file containing environment-specific configurations such as KYVOS_USERNAME, KYVOS_PASSWORD, KYVOS_URL, TRANSPORT, and other parameters. You can either use this file to load all parameters at once or specify them individually through command-line arguments or other configuration methods."
    MAX_ROWS= "Limit the number of rows in the response by specifying the row size."
    PORT_DESCRIPTION = "The port number on which the server will listen when using the Server-Sent Events (SSE) transport mode."
    SSL_KEY_FILE = "Path to the SSL key file"
    SSL_CERTIFICATE_FILE = "Path to the SSL certificate file"
    AUTH_TYPE = "Auth type the user want authenticate basic or oauth"
    MCP_SERVER_URL = " The URL where the user wants the MCP server to run. (http://your_url.com:8000)"
    LOG_LEVEL = "Specifies the log level to use (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL)."
    IS_FOLDER_NAME_REQUIRED="Specifies if the folder name is required for getting semantic models"
class Tools:
    LIST_SEMANTIC_MODELS_ALL = "list_semantic_models_all"
    LIST_SEMANTIC_MODELS = "list_semantic_models"
    LIST_SEMANTIC_MODEL_COLUMNS = "list_semantic_model_columns"
    EXECUTE_QUERY = "execute_query"