from app.extensions import db
from app.models import AbstractConfiguration, AbstractResource


class Onion(AbstractConfiguration):
    group_id = db.Column(db.Integer(), db.ForeignKey("group.id"), nullable=False)
    domain_name = db.Column(db.String(255), nullable=False)
    onion_name = db.Column(db.String(56), nullable=False, unique=True)

    group = db.relationship("Group", back_populates="onions")


class Eotk(AbstractResource):
    group_id = db.Column(db.Integer(), db.ForeignKey("group.id"), nullable=False)
    instance_id = db.Column(db.String(100), nullable=True)
    provider = db.Column(db.String(20), nullable=False)
    region = db.Column(db.String(20), nullable=False)

    group = db.relationship("Group", back_populates="eotks")
