

from sqlalchemy import create_engine, Column, Integer, String, MetaData,DateTime,Text,ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from agent.db.database import Base




class Job(Base):
    __tablename__ = 'jobs'
    id = Column(Integer, primary_key=True)
    job_category = Column(String(64), nullable=False)
    job_name = Column(String(64))
    job_details = Column(Text, nullable=False)
    job_creator = Column(String(64), nullable=False)
    job_logs = Column(Text, nullable=True)
    job_files = Column(String(300), nullable=True)
    executor = Column(String(64), nullable=True)
    created = Column(DateTime, nullable=False)
    updated = Column(DateTime, nullable=False)
    status = Column(Integer, default=0)
    
    

class JobQueue(Base):
    __tablename__ = 'job_queues'
    id = Column(Integer, primary_key=True)
    queue_category = Column(String(64), nullable=False)
    queue_name = Column(String(64), nullable=False)
    status = Column(Integer, default=0)
    

class QueueJob(Base):
    __tablename__ = 'queue_job'
    id = Column(Integer, primary_key=True)
    queue_id = Column(Integer, ForeignKey('job_queues.id'), nullable=False)
    job_id = Column(Integer, ForeignKey('jobs.id'), nullable=False)
