#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""数据库连接信息类型"""
from dataclasses import dataclass
from typing import Any, Dict, Optional


@dataclass
class ConnectionInfo:
    code: str
    db_type: str
    host: str
    port: int
    user: str
    password: str
    database: str
    is_system: bool = False
    display_name: str = ""
    extra_options: Optional[Dict[str, Any]] = None

    def to_handler_kwargs(self) -> Dict[str, Any]:
        return {
            "host": self.host,
            "port": self.port,
            "user": self.user,
            "password": self.password,
            "database": self.database,
        }
