from pydantic import BaseModel, ConfigDict
from typing import Optional, Any
from datetime import datetime

# --- Pontszabályok (Point Rules) ---
class PointRuleBase(BaseModel):
    rule_key: str
    points: int
    region_code: str = "GLOBAL"
    start_date: Optional[datetime] = None
    end_date: Optional[datetime] = None
    is_active: bool = True

class PointRuleCreate(PointRuleBase):
    pass

class PointRuleResponse(PointRuleBase):
    id: int
    model_config = ConfigDict(from_attributes=True)

# --- Regionális Beállítások (MOT, Tax, stb.) ---
class RegionalSettingBase(BaseModel):
    region_code: str
    setting_key: str
    value: Any  # JSON adat (pl. {"months": 24})
    start_date: Optional[datetime] = None
    end_date: Optional[datetime] = None

class RegionalSettingCreate(RegionalSettingBase):
    pass

# --- Szintlépési Konfiguráció ---
class LevelConfigBase(BaseModel):
    level_number: int
    min_points: int
    name_translation_key: str
    region_code: str = "GLOBAL"

class LevelConfigUpdate(LevelConfigBase):
    pass