import { CredentialDataSupplier, VcIssuer } from '@sphereon/oid4vci-issuer';
import { IOID4VCIServerOpts, OID4VCIServer } from '@sphereon/oid4vci-issuer-server';
import { ExpressSupport } from '@sphereon/ssi-express-support';
import { IOID4VCIIssuer, IIssuerInstanceArgs, IssuerInstance } from '@sphereon/ssi-sdk.oid4vci-issuer';
import { Express } from 'express';
import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution';
import { IOID4VCIStore } from '@sphereon/ssi-sdk.oid4vci-issuer-store';
import { IAgentContext, IDIDManager, IKeyManager, IResolver, ICredentialVerifier, ICredentialIssuer } from '@veramo/core';
import { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service';
import { IVcdmCredentialPlugin } from '@sphereon/ssi-sdk.credential-vcdm';
import { ICredentialStore } from '@sphereon/ssi-sdk.credential-store';

type IRequiredContext = IAgentContext<IPlugins>;
type IPlugins = IDIDManager & IKeyManager & IResolver & IIdentifierResolution & IOID4VCIStore & IOID4VCIIssuer & ICredentialVerifier & ICredentialIssuer & IJwtService & IVcdmCredentialPlugin & ICredentialStore;

interface IOID4VCIRestAPIOpts extends IOID4VCIServerOpts {
    /**
     * When `true`, every credential issued through this OID4VCI REST API is persisted as a
     * {@link CredentialRole.ISSUER} `DigitalCredential` row via the `ICredentialStore` plugin
     * (agent method `crsAddCredential`). Requires the `credential-store` plugin to be present
     * on the agent. Defaults to `false`.
     *
     * Persistence failures are surfaced (fail-fast): when this flag is enabled and the store
     * call throws, the enclosing issuance request fails with an error rather than silently
     * dropping the row. That is intentional — a silent drop is exactly the defect DEV-35 fixes.
     */
    persistIssuedCredentials?: boolean;
}
declare class OID4VCIRestAPI {
    private readonly _expressSupport;
    private readonly _context;
    private readonly _opts?;
    private readonly _restApi;
    private readonly _instance;
    private readonly _issuer;
    private readonly _router;
    private _baseUrl;
    private _basePath;
    static init(args: {
        context: IRequiredContext;
        issuerInstanceArgs: IIssuerInstanceArgs;
        credentialDataSupplier?: CredentialDataSupplier;
        expressSupport: ExpressSupport;
        opts?: IOID4VCIRestAPIOpts;
    }): Promise<OID4VCIRestAPI>;
    /**
     * Builds a {@link CredentialSignerCallback} wrapper that persists each issued credential as a
     * {@link CredentialRole.ISSUER} `DigitalCredential` row after delegating the actual signing to
     * the underlying signer. Issuer identity is resolved from the *signed* credential (so any
     * issuer normalization performed by the signer is preserved in the persisted row). The
     * correlation type is derived from the resolved issuer id (`did:` prefix -> DID, otherwise URL),
     * matching the pattern used by the holder-side persistence in `OID4VCIHolder`.
     *
     * Persistence errors propagate to the caller (fail-fast). Callers that opt into
     * `persistIssuedCredentials` are explicitly requesting the row; a silent drop here would
     * reproduce the DEV-35 defect.
     */
    private static buildPersistenceSignerWrapper;
    private readonly OID4VCI_OPENAPI_FILE;
    private constructor();
    private setupSwaggerUi;
    get express(): Express;
    get context(): IRequiredContext;
    get opts(): IOID4VCIRestAPIOpts | undefined;
    get restApi(): OID4VCIServer;
    get instance(): IssuerInstance;
    get issuer(): VcIssuer;
    stop(): Promise<boolean>;
}

export { type IOID4VCIRestAPIOpts, type IPlugins, type IRequiredContext, OID4VCIRestAPI };
