# Code generated by highflame-policy-codegen. DO NOT EDIT.
# Source: schema/highflame.cedarschema

"""Entity types for Highflame Cedar policies."""

from typing import Any, TypedDict

class EntityType:
    """Entity types defined in the Highflame Cedar schema."""

    AGENT: str = "Agent"
    ARTIFACT: str = "Artifact"
    FILE_PATH: str = "FilePath"
    HTTP_ENDPOINT: str = "HttpEndpoint"
    PACKAGE: str = "Package"
    REPOSITORY: str = "Repository"
    RESOURCE: str = "Resource"
    RESPONSE_DATA: str = "ResponseData"
    SCANNER: str = "Scanner"
    SERVER: str = "Server"
    SERVICE: str = "Service"
    TOOL: str = "Tool"
    USER: str = "User"


class EntityUID(TypedDict):
    """Cedar entity unique identifier."""

    type: str
    id: str


class Entity(TypedDict, total=False):
    """Cedar entity with attributes."""

    uid: EntityUID
    attrs: dict[str, Any]
    parents: list[EntityUID]


def new_entity_uid(entity_type: str, entity_id: str) -> EntityUID:
    """
    Create a new EntityUID.

    Services should use this with their own identity from config/environment.
    Example: new_entity_uid(EntityType.SCANNER, os.environ['SERVICE_ID'])
    """
    return {"type": entity_type, "id": entity_id}


def new_entity(
    entity_type: str,
    entity_id: str,
    attrs: dict[str, Any] | None = None,
) -> Entity:
    """Create a new Entity."""
    return {
        "uid": {"type": entity_type, "id": entity_id},
        "attrs": attrs or {},
        "parents": [],
    }
