package net.siegeln.cameleer.saas.provisioning;

import net.siegeln.cameleer.saas.certificate.CertificateInfo;
import net.siegeln.cameleer.saas.certificate.CertificateManager;
import net.siegeln.cameleer.saas.certificate.CertValidationResult;

import java.util.List;

/**
 * No-op certificate manager when certs directory is not available.
 */
public class DisabledCertificateManager implements CertificateManager {

    @Override
    public boolean isAvailable() { return false; }

    @Override
    public CertificateInfo getActive() { return null; }

    @Override
    public CertificateInfo getStaged() { return null; }

    @Override
    public CertificateInfo getArchived() { return null; }

    @Override
    public CertValidationResult stage(byte[] certPem, byte[] keyPem, byte[] caBundlePem) {
        return CertValidationResult.fail(List.of("Certificate management is not available"));
    }

    @Override
    public void activate() {}

    @Override
    public void restore() {}

    @Override
    public void discardStaged() {}

    @Override
    public void generateSelfSigned(String hostname) {}

    @Override
    public byte[] getCaBundle() { return null; }
}
