from pony.orm import Database, Required, Json, StrArray
from settings import DB_CONFIG

db = Database()
db.bind(**DB_CONFIG)


class UserState(db.Entity):

    user_id = Required(str, unique=True)
    scenario_name = Required(str)
    step_name = Required(str)
    context = Required(Json)


class Ticket(db.Entity):
    departure_city = Required(str)
    arrival_city = Required(str)
    date = Required(str)
    flight = Required(str)
    sits = Required(int)
    phone_number = Required(StrArray)


db.generate_mapping(create_tables=True)
