// Package port defines interfaces (ports) for external dependencies.
// These interfaces define the contracts between the application core and
// infrastructure adapters, enabling testability and flexibility.
package port

import (
	"context"

	"{{GO_MODULE}}/services/{{COMPONENT_NAME}}/internal/domain"
)

// ExampleRepository defines the interface for example persistence operations.
// Implementations may use databases, in-memory storage, or external services.
type ExampleRepository interface {
	// List returns all examples.
	List(ctx context.Context) ([]domain.Example, error)

	// Get returns an example by ID.
	// Returns domain.ErrExampleNotFound if not found.
	Get(ctx context.Context, id domain.ExampleID) (*domain.Example, error)

	// Create stores a new example.
	// The example must have a valid ID set.
	Create(ctx context.Context, example *domain.Example) error

	// Update modifies an existing example.
	// Returns domain.ErrExampleNotFound if not found.
	Update(ctx context.Context, example *domain.Example) error

	// Delete removes an example by ID.
	// Returns domain.ErrExampleNotFound if not found.
	Delete(ctx context.Context, id domain.ExampleID) error

	// ExistsByName checks if an example with the given name exists.
	// Used for duplicate detection.
	ExistsByName(ctx context.Context, name string) (bool, error)
}
