from __future__ import annotations

from dataclasses import dataclass
from uuid import uuid4

from packages.domain import ClassificationJob
from packages.ports.classification_job_repository import ClassificationJobRepository


@dataclass(slots=True)
class SubmitClassificationJobCommand:
    project_id: str
    asset_id: str


class SubmitClassificationJobUseCase:
    def __init__(self, classification_job_repository: ClassificationJobRepository):
        self.classification_job_repository = classification_job_repository

    def execute(self, command: SubmitClassificationJobCommand) -> ClassificationJob:
        job = ClassificationJob(
            id=uuid4().hex,
            project_id=command.project_id,
            asset_id=command.asset_id,
            status="pending",
            classification="",
            confidence=0.0,
            error_message="",
        )
        return self.classification_job_repository.create(job)
