// Package domain contains pure domain models with no external dependencies.
package domain

import "slices"

// SDLCGenerateRequest describes an artifact generation request.
type SDLCGenerateRequest struct {
	// ArtifactType is the type of artifact to generate: spec, design, tasks, code, qa
	ArtifactType string `json:"artifact_type"`

	// TaskID is the specific task to implement (required for artifact_type: "code")
	TaskID string `json:"task_id,omitempty"`

	// Provider specifies which code agent to use (optional, defaults to system default)
	Provider string `json:"provider,omitempty"`
}

// ValidArtifactTypesForGenerate lists artifact types that can be generated.
var ValidArtifactTypesForGenerate = []string{"spec", "design", "tasks", "code", "qa"}

// IsValidGenerateArtifactType returns true if the artifact type is valid for generation.
func IsValidGenerateArtifactType(artifactType string) bool {
	return slices.Contains(ValidArtifactTypesForGenerate, artifactType)
}

// SDLCCallbackPayload is sent when a build completes to update SDLC artifact status.
type SDLCCallbackPayload struct {
	// TaskID is the work queue task identifier
	TaskID string `json:"task_id"`

	// ProjectID is the project this task belongs to
	ProjectID string `json:"project_id"`

	// Feature is the feature slug this artifact belongs to
	Feature string `json:"feature"`

	// ArtifactType identifies which artifact was generated
	ArtifactType string `json:"artifact_type"`

	// Success indicates whether the generation succeeded
	Success bool `json:"success"`

	// CommitSHA is the git commit SHA if changes were committed
	CommitSHA string `json:"commit_sha,omitempty"`

	// Error contains the error message if generation failed
	Error string `json:"error,omitempty"`
}

// SDLCGenerateResponse is the response for artifact generation requests.
type SDLCGenerateResponse struct {
	// TaskID is the work queue task identifier for tracking
	TaskID string `json:"task_id"`

	// ProjectID is the project identifier
	ProjectID string `json:"project_id"`

	// Feature is the feature slug
	Feature string `json:"feature"`

	// ArtifactType is the type of artifact being generated
	ArtifactType string `json:"artifact_type"`

	// Status is the initial task status (always "pending")
	Status string `json:"status"`

	// StatusURL is the URL to check task status
	StatusURL string `json:"status_url"`

	// StreamURL is the URL for real-time event streaming
	StreamURL string `json:"stream_url"`
}
