from sqlalchemy.dialects.postgresql import ARRAY

import Models
from app import db


class GameUserModel(Models.Base):
    __tablename__ = 'game_user'

    user_id = db.Column(db.ForeignKey('user.id'), primary_key=True)
    user = db.relationship(
        "UserModel",
        back_populates="game_user"
    )
    total_score = db.Column(db.Integer, nullable=False, default=0)
    air_score = db.Column(db.Integer, nullable=False, default=0)
    distance_score = db.Column(db.Integer, nullable=False, default=0)
    game_points = db.Column(db.Integer, nullable=False, default=0)
    prices = db.Column(ARRAY(db.String), nullable=True)  # do not use append always assign a new array
