package events

import (
	"bit.admedia.com/scm/ad/adpilot-indexing-code-parser.com/internal/contracts/metadata"
)

// RepoSnapshotReadyEvent is published when a repository snapshot is available.
type RepoSnapshotReadyEvent struct {
	metadata.Envelope
	RepoID      string `json:"repo_id"`
	SnapshotID  string `json:"snapshot_id"`
	CommitSHA   string `json:"commit_sha"`
	Ref         string `json:"ref"`
	ArtifactURI string `json:"artifact_uri,omitempty"`
	FileCount   int    `json:"file_count,omitempty"`
}

// NewRepoSnapshotReadyEvent creates a v1 snapshot-ready event.
func NewRepoSnapshotReadyEvent(eventID, repoID, snapshotID, commitSHA, ref string) RepoSnapshotReadyEvent {
	return RepoSnapshotReadyEvent{
		Envelope:   metadata.NewEnvelope(eventID),
		RepoID:     repoID,
		SnapshotID: snapshotID,
		CommitSHA:  commitSHA,
		Ref:        ref,
	}
}
