from dataclasses import dataclass, field
from typing import Any, Optional
from orionis.test.enums.test_status import TestStatus

@dataclass(frozen=True, kw_only=True)
class TestResult:
    """
    Represents the result of a test execution.
    """

    id: Any = field(
        metadata={
            "description": "Unique identifier for the test result."
        }
    )

    name: str = field(
        metadata={
            "description": "Name of the test."
        }
    )

    status: TestStatus = field(
        metadata={
            "description": "Status of the test execution (e.g., passed, failed)."
        }
    )

    execution_time: float = field(
        metadata={
            "description": "Time taken to execute the test, in seconds."
        }
    )

    error_message: Optional[str] = field(
        default=None,
        metadata={
            "description": "Error message if the test failed, otherwise None."
        }
    )

    traceback: Optional[str] = field(
        default=None,
        metadata={
            "description": "Traceback information if an error occurred, otherwise None."
        }
    )

    class_name: Optional[str] = field(
        default=None,
        metadata={
            "description": "Name of the class containing the test, if applicable."
        }
    )

    method: Optional[str] = field(
        default=None,
        metadata={
            "description": "Name of the method representing the test, if applicable."
        }
    )

    module: Optional[str] = field(
        default=None,
        metadata={
            "description": "Name of the module containing the test, if applicable."
        }
    )

    file_path: Optional[str] = field(
        default=None,
        metadata={
            "description": "Path to the file containing the test, if applicable."
        }
    )
