package repository

import (
	"context"

	"github.com/RyanCopley/skybridge/faas/internal/domain"
	"github.com/google/uuid"
)

// FunctionRepository provides CRUD operations for functions
type FunctionRepository interface {
	Create(ctx context.Context, function *domain.FunctionDefinition) (*domain.FunctionDefinition, error)
	GetByID(ctx context.Context, id uuid.UUID) (*domain.FunctionDefinition, error)
	GetByName(ctx context.Context, appID, name string) (*domain.FunctionDefinition, error)
	Update(ctx context.Context, id uuid.UUID, updates *domain.UpdateFunctionRequest) (*domain.FunctionDefinition, error)
	Delete(ctx context.Context, id uuid.UUID) error
	List(ctx context.Context, appID string, limit, offset int) ([]*domain.FunctionDefinition, error)
	GetByAppID(ctx context.Context, appID string) ([]*domain.FunctionDefinition, error)
}

// ExecutionRepository provides CRUD operations for function executions
type ExecutionRepository interface {
	Create(ctx context.Context, execution *domain.FunctionExecution) (*domain.FunctionExecution, error)
	GetByID(ctx context.Context, id uuid.UUID) (*domain.FunctionExecution, error)
	Update(ctx context.Context, id uuid.UUID, execution *domain.FunctionExecution) (*domain.FunctionExecution, error)
	Delete(ctx context.Context, id uuid.UUID) error
	List(ctx context.Context, functionID *uuid.UUID, limit, offset int) ([]*domain.FunctionExecution, error)
	GetByFunctionID(ctx context.Context, functionID uuid.UUID, limit, offset int) ([]*domain.FunctionExecution, error)
	GetByStatus(ctx context.Context, status domain.ExecutionStatus, limit, offset int) ([]*domain.FunctionExecution, error)
	UpdateStatus(ctx context.Context, id uuid.UUID, status domain.ExecutionStatus) error
	GetRunningExecutions(ctx context.Context) ([]*domain.FunctionExecution, error)
}