package graph

const SchemaVersionV1 = "v1"

// NodeKind identifies the type of graph node.
type NodeKind string

const (
	NodeKindFile    NodeKind = "file"
	NodeKindPackage NodeKind = "package"
	NodeKindSymbol  NodeKind = "symbol"
)

// EdgeKind identifies the type of graph edge.
type EdgeKind string

const (
	EdgeKindContains EdgeKind = "contains"
	EdgeKindImports  EdgeKind = "imports"
	EdgeKindCalls    EdgeKind = "calls"
	EdgeKindDefines  EdgeKind = "defines"
)

// Node represents a node in the code graph IR.
type Node struct {
	ID       string            `json:"id"`
	Kind     NodeKind          `json:"kind"`
	Name     string            `json:"name"`
	Language string            `json:"language,omitempty"`
	Path     string            `json:"path,omitempty"`
	Metadata map[string]string `json:"metadata,omitempty"`
}

// Edge represents a relationship between graph nodes.
type Edge struct {
	ID       string            `json:"id"`
	Kind     EdgeKind          `json:"kind"`
	SourceID string            `json:"source_id"`
	TargetID string            `json:"target_id"`
	Metadata map[string]string `json:"metadata,omitempty"`
}

// Artifact is the portable graph artifact emitted by the parser service.
type Artifact struct {
	SchemaVersion string `json:"schema_version"`
	RepoID        string `json:"repo_id"`
	CommitSHA     string `json:"commit_sha"`
	SnapshotID    string `json:"snapshot_id"`
	Nodes         []Node `json:"nodes"`
	Edges         []Edge `json:"edges"`
}
