from typing import Optional
from sqlmodel import Field, SQLModel
from datetime import datetime, date


class Rate(SQLModel, table=True):
    """Create an SQLModel for rates"""

    id: Optional[int] = Field(default=None, primary_key=True)
    user_id: int = Field(foreign_key="app_db.appuser.id")
    client_id: int = Field(foreign_key="app_db.client.id")
    valid_from: date
    valid_to: date
    amount: float  # currency: EUR
    created_at: datetime
    updated_at: datetime
    is_active: bool

    __table_args__ = {"schema": "app_db"}

sqlmodel.Field
[((201, 238), 'sqlmodel.Field', 'Field', ([], {'default': 'None', 'primary_key': '(True)'}), '(default=None, primary_key=True)\n', (206, 238), False, 'from sqlmodel import Field, SQLModel\n'), ((258, 296), 'sqlmodel.Field', 'Field', ([], {'foreign_key': '"""app_db.appuser.id"""'}), "(foreign_key='app_db.appuser.id')\n", (263, 296), False, 'from sqlmodel import Field, SQLModel\n'), ((318, 355), 'sqlmodel.Field', 'Field', ([], {'foreign_key': '"""app_db.client.id"""'}), "(foreign_key='app_db.client.id')\n", (323, 355), False, 'from sqlmodel import Field, SQLModel\n')]