from datetime import datetime, timezone
from typing import List, Optional
from sqlmodel import Field, Relationship, SQLModel, Session, select
from sqlalchemy.engine import Engine


class Post(SQLModel, table=True):
    __tablename__ = "ig_posts"

    id: Optional[int] = Field(default=None, primary_key=True)

    ig_account_id: int = Field(foreign_key="ig_accounts.id")
    ig_pk: int
    webhook_message_id: Optional[int] = None

    ig_account: "IGAccount" = Relationship(back_populates="ig_posts")


class IGAccount(SQLModel, table=True):
    __tablename__ = "ig_accounts"

    id: Optional[int] = 