"""Pack Service Profile model."""

from __future__ import annotations

from typing import Any, Dict, Optional

from netorca_sdk.v2.base import BaseModel


class PackServiceProfile(BaseModel):
    """
    Pack Service Profile model.

    Represents an AI pack configuration profile for a service.

    Attributes:
        id: Profile ID
        service: Associated service
        config: Profile configuration
    """

    @property
    def service_id(self) -> Optional[int]:
        """Get service ID."""
        service = self.data.get("service")
        if isinstance(service, dict):
            return service.get("id")
        return service

    @property
    def service_name(self) -> Optional[str]:
        """Get service name."""
        service = self.data.get("service")
        if isinstance(service, dict):
            return service.get("name")
        return None

    @property
    def config(self) -> Optional[Dict[str, Any]]:
        """Get profile configuration."""
        return self.data.get("config")

    @property
    def name(self) -> Optional[str]:
        """Get profile name."""
        return self.data.get("name")

    @property
    def description(self) -> Optional[str]:
        """Get profile description."""
        return self.data.get("description")

    @property
    def is_active(self) -> bool:
        """Check if profile is active."""
        return self.data.get("is_active", False)

    def __repr__(self) -> str:
        return f"PackServiceProfile(id={self.id}, service_id={self.service_id})"
