package com.cameleer.server.core.runtime;

import java.util.List;
import java.util.Optional;
import java.util.UUID;

public interface DeploymentRepository {
    List<Deployment> findByAppId(UUID appId);
    List<Deployment> findByEnvironmentId(UUID environmentId);
    Optional<Deployment> findById(UUID id);
    Optional<Deployment> findActiveByAppIdAndEnvironmentId(UUID appId, UUID environmentId);
    Optional<Deployment> findActiveByAppIdAndEnvironmentIdExcluding(UUID appId, UUID environmentId, UUID excludeDeploymentId);
    UUID create(UUID appId, UUID appVersionId, UUID environmentId, String containerName, String createdBy);
    void updateStatus(UUID id, DeploymentStatus status, String containerId, String errorMessage);
    void markDeployed(UUID id);
    void markStopped(UUID id);
    /** Delete FAILED deployments for this (app, env). STOPPED deployments are preserved as checkpoints. */
    void deleteFailedByAppAndEnvironment(UUID appId, UUID environmentId);
}
