package port

import (
	"context"

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

// MediaRepository defines the interface for media metadata persistence.
type MediaRepository interface {
	// Create persists a new media object record.
	Create(ctx context.Context, obj *domain.MediaObject) error

	// Get returns a media object by ID. Returns domain.ErrNotFound if not found or soft-deleted.
	Get(ctx context.Context, id domain.MediaObjectID) (*domain.MediaObject, error)

	// ListByUser returns non-deleted media objects for a user, ordered by created_at DESC.
	ListByUser(ctx context.Context, userID domain.UserID, opts ListMediaOptions) ([]domain.MediaObject, int, error)

	// SoftDelete marks a media object as deleted without removing it.
	SoftDelete(ctx context.Context, id domain.MediaObjectID) error

	// HardDelete permanently removes a media object record.
	HardDelete(ctx context.Context, id domain.MediaObjectID) error

	// GetByPath returns a media object by its storage path. Returns domain.ErrNotFound if not found.
	GetByPath(ctx context.Context, path string) (*domain.MediaObject, error)
}

// ListMediaOptions controls filtering and pagination for media queries.
type ListMediaOptions struct {
	// ContentTypePrefix filters by MIME type prefix (e.g., "image/", "video/").
	ContentTypePrefix string
	// Limit is the maximum number of results (0 = default 50).
	Limit int
	// Offset is the pagination offset.
	Offset int
}
