#
#   Imandra Inc.
#
#   speclogician/data/artifact.py
#

from __future__ import annotations

import uuid
from pydantic import BaseModel, Field, field_validator

class Artifact(BaseModel):
    """
    Base class for an Artifact
    """
    # Assigned task ID, new one created if not provided
    art_id : str | None = Field(default_factory=lambda: str(uuid.uuid4()))

    @field_validator("art_id", mode="before")
    @classmethod
    def _coerce_none_to_uuid(cls, v:str|None):
        if v is None:
            return str(uuid.uuid4())
        return v

class DataArtifact(Artifact):
    """
    Data may be either source code or documentation
    """
    pass