from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Optional, Sequence

@dataclass(frozen=True)
class QueryConfig:
    max_rows: int = 1000
    max_bytes_processed: int = 2_000_000_000  # 2GB
    require_params: bool = True
    deny_patterns: Sequence[str] = (
        r"\bDROP\b",
        r"\bTRUNCATE\b",
        r"\bDELETE\b",
        r"\bALTER\b",
        r"\bCREATE\s+TABLE\b",
        r"\bCREATE\s+OR\s+REPLACE\b",
    )

@dataclass(frozen=True)
class QueryResult:
    sql: str
    job_id: str
    total_bytes_processed: int
    rows: list[dict[str, Any]]

@dataclass(frozen=True)
class FieldSchema:
    name: str
    field_type: str
    mode: str
    description: Optional[str] = None

@dataclass(frozen=True)
class TableSchema:
    project: str
    dataset: str
    table: str
    fields: list[FieldSchema]

@dataclass(frozen=True)
class DatasetInfo:
    project: str
    dataset: str
    location: Optional[str] = None

@dataclass(frozen=True)
class TableInfo:
    project: str
    dataset: str
    table: str
    table_type: Optional[str] = None

