<reponame>quickgiant/computone
from uuid import UUID
from fastapi import status, HTTPException

from models.job import JobStatus


class JobNotFoundException(HTTPException):
    status_code = status.HTTP_404_NOT_FOUND
    detail = "Job not found"

    def __init__(self, job_id: UUID):
        self.job_id = job_id


class JobNotRunningException(HTTPException):
    status_code = status.HTTP_409_CONFLICT
    detail = "Job is not running"

    def __init__(self, job_id: UUID):
        self.job_id = job_id


class JobStatusTransitionNotAllowedException(HTTPException):
    status_code = status.HTTP_409_CONFLICT
    detail = "Job status transition not allowed"

    def __init__(self, from_status: JobStatus, to_status: JobStatus):
        self.from_status = from_status
        self.to_status = to_status

from uuid import UUID
from fastapi import status, HTTPException

from models.job import JobStatus


class JobNotFoundException(HTTPException):
    status_code = status.HTTP_404_NOT_FOUND
    detail = "Job not found"

    def __init__(self, job_id: UUID):
        self.job_id = job_id


class JobNotRunningException(HTTPException):
    status_code = status.HTTP_409_CONFLICT
    detail = "Job is not running"

    def __init__(self, job_id: UUID):
        self.job_id = job_id


class JobStatusTransitionNotAllowedException(HTTPException):
    status_code = status.HTTP_409_CONFLICT
    detail = "Job status transition not allowed"

    def __init__(self, from_status: JobStatus, to_status: JobStatus):
        self.from_status = from_status
        self.to_status = to_status