import { Effect, Schema } from "effect";
import type { StorageFailure } from "./fuma-runtime";
import { type CredentialBindingRow } from "./core-schema";
import { CredentialBindingId, ScopeId } from "./ids";
import type { Usage } from "./usages";
export declare const CredentialBindingKind: Schema.Literals<readonly ["text", "secret", "connection"]>;
export type CredentialBindingKind = typeof CredentialBindingKind.Type;
export declare const CredentialBindingValue: Schema.Union<readonly [Schema.Struct<{
    readonly kind: Schema.Literal<"text">;
    readonly text: Schema.String;
}>, Schema.Struct<{
    readonly kind: Schema.Literal<"secret">;
    readonly secretId: Schema.brand<Schema.String, "SecretId">;
    readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
}>, Schema.Struct<{
    readonly kind: Schema.Literal<"connection">;
    readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
}>]>;
export type CredentialBindingValue = typeof CredentialBindingValue.Type;
export declare const ConfiguredCredentialBinding: Schema.Struct<{
    readonly kind: Schema.Literal<"binding">;
    readonly slot: Schema.String;
    readonly prefix: Schema.optional<Schema.String>;
}>;
export type ConfiguredCredentialBinding = typeof ConfiguredCredentialBinding.Type;
export declare const ConfiguredCredentialValue: Schema.Union<readonly [Schema.String, Schema.Struct<{
    readonly kind: Schema.Literal<"binding">;
    readonly slot: Schema.String;
    readonly prefix: Schema.optional<Schema.String>;
}>]>;
export type ConfiguredCredentialValue = typeof ConfiguredCredentialValue.Type;
export declare const ScopedSecretCredentialInput: Schema.Struct<{
    readonly secretId: Schema.String;
    readonly prefix: Schema.optional<Schema.String>;
    readonly targetScope: Schema.brand<Schema.String, "ScopeId">;
    readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
}>;
export type ScopedSecretCredentialInput = typeof ScopedSecretCredentialInput.Type;
export declare const CredentialBindingRef: Schema.Struct<{
    readonly id: Schema.brand<Schema.String, "CredentialBindingId">;
    readonly scopeId: Schema.brand<Schema.String, "ScopeId">;
    readonly pluginId: Schema.String;
    readonly sourceId: Schema.String;
    readonly sourceScopeId: Schema.brand<Schema.String, "ScopeId">;
    readonly slotKey: Schema.String;
    readonly value: Schema.Union<readonly [Schema.Struct<{
        readonly kind: Schema.Literal<"text">;
        readonly text: Schema.String;
    }>, Schema.Struct<{
        readonly kind: Schema.Literal<"secret">;
        readonly secretId: Schema.brand<Schema.String, "SecretId">;
        readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
    }>, Schema.Struct<{
        readonly kind: Schema.Literal<"connection">;
        readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
    }>]>;
    readonly createdAt: Schema.Date;
    readonly updatedAt: Schema.Date;
}>;
export type CredentialBindingRef = typeof CredentialBindingRef.Type;
export type SetPluginCredentialBindingInput = {
    readonly targetScope: ScopeId;
    readonly pluginId: string;
    readonly sourceId: string;
    readonly sourceScope: ScopeId;
    readonly slotKey: string;
    readonly value: CredentialBindingValue;
};
export declare const CredentialBindingSourceInput: Schema.Struct<{
    readonly pluginId: Schema.String;
    readonly sourceId: Schema.String;
    readonly sourceScope: Schema.brand<Schema.String, "ScopeId">;
}>;
export type CredentialBindingSourceInput = typeof CredentialBindingSourceInput.Type;
export declare const CredentialBindingSlotInput: Schema.Struct<{
    readonly pluginId: Schema.String;
    readonly sourceId: Schema.String;
    readonly sourceScope: Schema.brand<Schema.String, "ScopeId">;
    readonly slotKey: Schema.String;
}>;
export type CredentialBindingSlotInput = typeof CredentialBindingSlotInput.Type;
export declare const RemoveCredentialBindingInput: Schema.Struct<{
    readonly targetScope: Schema.brand<Schema.String, "ScopeId">;
    readonly pluginId: Schema.String;
    readonly sourceId: Schema.String;
    readonly sourceScope: Schema.brand<Schema.String, "ScopeId">;
    readonly slotKey: Schema.String;
}>;
export type RemoveCredentialBindingInput = typeof RemoveCredentialBindingInput.Type;
export declare const ReplaceCredentialBindingValue: Schema.Struct<{
    readonly slotKey: Schema.String;
    readonly value: Schema.Union<readonly [Schema.Struct<{
        readonly kind: Schema.Literal<"text">;
        readonly text: Schema.String;
    }>, Schema.Struct<{
        readonly kind: Schema.Literal<"secret">;
        readonly secretId: Schema.brand<Schema.String, "SecretId">;
        readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
    }>, Schema.Struct<{
        readonly kind: Schema.Literal<"connection">;
        readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
    }>]>;
}>;
export type ReplaceCredentialBindingValue = typeof ReplaceCredentialBindingValue.Type;
export declare const ReplaceCredentialBindingsInput: Schema.Struct<{
    readonly targetScope: Schema.brand<Schema.String, "ScopeId">;
    readonly pluginId: Schema.String;
    readonly sourceId: Schema.String;
    readonly sourceScope: Schema.brand<Schema.String, "ScopeId">;
    readonly slotPrefixes: Schema.$Array<Schema.String>;
    readonly bindings: Schema.$Array<Schema.Struct<{
        readonly slotKey: Schema.String;
        readonly value: Schema.Union<readonly [Schema.Struct<{
            readonly kind: Schema.Literal<"text">;
            readonly text: Schema.String;
        }>, Schema.Struct<{
            readonly kind: Schema.Literal<"secret">;
            readonly secretId: Schema.brand<Schema.String, "SecretId">;
            readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
        }>, Schema.Struct<{
            readonly kind: Schema.Literal<"connection">;
            readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
        }>]>;
    }>>;
}>;
export type ReplaceCredentialBindingsInput = typeof ReplaceCredentialBindingsInput.Type;
export declare const SourceCredentialBindingSource: Schema.Struct<{
    readonly id: Schema.String;
    readonly scope: Schema.brand<Schema.String, "ScopeId">;
}>;
export type SourceCredentialBindingSource = typeof SourceCredentialBindingSource.Type;
export declare const SourceCredentialBindingSourceInput: Schema.Struct<{
    readonly source: Schema.Struct<{
        readonly id: Schema.String;
        readonly scope: Schema.brand<Schema.String, "ScopeId">;
    }>;
}>;
export type SourceCredentialBindingSourceInput = typeof SourceCredentialBindingSourceInput.Type;
export declare const SourceCredentialBindingSlotInput: Schema.Struct<{
    readonly source: Schema.Struct<{
        readonly id: Schema.String;
        readonly scope: Schema.brand<Schema.String, "ScopeId">;
    }>;
    readonly slotKey: Schema.String;
}>;
export type SourceCredentialBindingSlotInput = typeof SourceCredentialBindingSlotInput.Type;
export declare const SetSourceCredentialBindingInput: Schema.Struct<{
    readonly scope: Schema.brand<Schema.String, "ScopeId">;
    readonly source: Schema.Struct<{
        readonly id: Schema.String;
        readonly scope: Schema.brand<Schema.String, "ScopeId">;
    }>;
    readonly slotKey: Schema.String;
    readonly value: Schema.Union<readonly [Schema.Struct<{
        readonly kind: Schema.Literal<"text">;
        readonly text: Schema.String;
    }>, Schema.Struct<{
        readonly kind: Schema.Literal<"secret">;
        readonly secretId: Schema.brand<Schema.String, "SecretId">;
        readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
    }>, Schema.Struct<{
        readonly kind: Schema.Literal<"connection">;
        readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
    }>]>;
}>;
export type SetSourceCredentialBindingInput = typeof SetSourceCredentialBindingInput.Type;
export declare const RemoveSourceCredentialBindingInput: Schema.Struct<{
    readonly scope: Schema.brand<Schema.String, "ScopeId">;
    readonly source: Schema.Struct<{
        readonly id: Schema.String;
        readonly scope: Schema.brand<Schema.String, "ScopeId">;
    }>;
    readonly slotKey: Schema.String;
}>;
export type RemoveSourceCredentialBindingInput = typeof RemoveSourceCredentialBindingInput.Type;
export declare const ReplaceSourceCredentialBindingsInput: Schema.Struct<{
    readonly scope: Schema.brand<Schema.String, "ScopeId">;
    readonly source: Schema.Struct<{
        readonly id: Schema.String;
        readonly scope: Schema.brand<Schema.String, "ScopeId">;
    }>;
    readonly slotPrefixes: Schema.$Array<Schema.String>;
    readonly bindings: Schema.$Array<Schema.Struct<{
        readonly slotKey: Schema.String;
        readonly value: Schema.Union<readonly [Schema.Struct<{
            readonly kind: Schema.Literal<"text">;
            readonly text: Schema.String;
        }>, Schema.Struct<{
            readonly kind: Schema.Literal<"secret">;
            readonly secretId: Schema.brand<Schema.String, "SecretId">;
            readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
        }>, Schema.Struct<{
            readonly kind: Schema.Literal<"connection">;
            readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
        }>]>;
    }>>;
}>;
export type ReplaceSourceCredentialBindingsInput = typeof ReplaceSourceCredentialBindingsInput.Type;
export declare const CredentialBindingResolutionStatus: Schema.Literals<readonly ["resolved", "missing", "blocked"]>;
export type CredentialBindingResolutionStatus = typeof CredentialBindingResolutionStatus.Type;
export declare const ResolvedCredentialSlot: Schema.Struct<{
    readonly pluginId: Schema.String;
    readonly sourceId: Schema.String;
    readonly sourceScopeId: Schema.brand<Schema.String, "ScopeId">;
    readonly slotKey: Schema.String;
    readonly bindingScopeId: Schema.NullOr<Schema.brand<Schema.String, "ScopeId">>;
    readonly kind: Schema.NullOr<Schema.Literals<readonly ["text", "secret", "connection"]>>;
    readonly status: Schema.Literals<readonly ["resolved", "missing", "blocked"]>;
}>;
export type ResolvedCredentialSlot = typeof ResolvedCredentialSlot.Type;
export interface CredentialBindingsFacade {
    readonly listForSource: (input: CredentialBindingSourceInput) => Effect.Effect<readonly CredentialBindingRef[], StorageFailure>;
    readonly resolveBinding: (input: CredentialBindingSlotInput) => Effect.Effect<CredentialBindingRef | null, StorageFailure>;
    readonly resolve: (input: CredentialBindingSlotInput) => Effect.Effect<ResolvedCredentialSlot, StorageFailure>;
    readonly set: (input: SetPluginCredentialBindingInput) => Effect.Effect<CredentialBindingRef, StorageFailure>;
    readonly remove: (input: RemoveCredentialBindingInput) => Effect.Effect<void, StorageFailure>;
    readonly replaceForSource: (input: ReplaceCredentialBindingsInput) => Effect.Effect<readonly CredentialBindingRef[], StorageFailure>;
    readonly removeForSource: (input: CredentialBindingSourceInput) => Effect.Effect<void, StorageFailure>;
    readonly usagesForSecret: (id: string) => Effect.Effect<readonly Usage[], StorageFailure>;
    readonly usagesForConnection: (id: string) => Effect.Effect<readonly Usage[], StorageFailure>;
}
export declare const credentialBindingId: (input: {
    readonly pluginId: string;
    readonly sourceId: string;
    readonly sourceScope: string;
    readonly slotKey: string;
}) => CredentialBindingId;
export declare const credentialSlotPart: (value: string) => string;
export declare const credentialSlotKey: (prefix: string, name: string) => string;
export declare const credentialBindingValueFromRow: (row: CredentialBindingRow) => CredentialBindingValue;
export declare const credentialBindingRowToRef: (row: CredentialBindingRow) => CredentialBindingRef;
//# sourceMappingURL=credential-bindings.d.ts.map