import * as HttpApi from "@effect/platform/HttpApi";
import * as HttpApiEndpoint from "@effect/platform/HttpApiEndpoint";
import * as HttpApiGroup from "@effect/platform/HttpApiGroup";
import type * as HttpClientError from "@effect/platform/HttpClientError";
import * as Context from "effect/Context";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as Option from "effect/Option";
import * as Model from "../Model.ts";
import * as Error from "./Error.ts";
/**
 * Error type for the `registerDataset` endpoint.
 *
 * - InvalidPayloadFormat: Request JSON is malformed or invalid.
 * - InvalidManifest: Manifest JSON is malformed or structurally invalid.
 * - DependencyValidationError: SQL queries reference undeclared dependencies.
 * - UnsupportedDatasetKind: Dataset kind is not supported.
 * - ManifestRegistrationError: Failed to register manifest in system.
 * - ManifestLinkingError: Failed to link manifest to dataset.
 * - VersionTaggingError: Failed to tag version for the dataset.
 * - StoreError: Dataset store operation error.
 * - ManifestNotFound: Manifest hash provided but manifest doesn't exist.
 */
export type RegisterDatasetError = Error.InvalidPayloadFormat | Error.InvalidManifest | Error.DependencyValidationError | Error.UnsupportedDatasetKind | Error.ManifestRegistrationError | Error.ManifestLinkingError | Error.VersionTaggingError | Error.StoreError | Error.ManifestNotFound;
/**
 * Error type for the `getDatasets` endpoint.
 *
 * - DatasetStoreError: Failed to retrieve datasets from the dataset store.
 * - MetadataDbError: Database error while retrieving active locations for tables.
 */
export type GetDatasetsError = Error.DatasetStoreError | Error.MetadataDbError;
/**
 * Error type for the `getDatasetVersions` endpoint.
 *
 * - InvalidRequest: Invalid namespace or name in path parameters.
 * - DatasetStoreError: Failed to list version tags from dataset store.
 * - MetadataDbError: Database error while retrieving versions.
 */
export type GetDatasetVersionsError = Error.InvalidRequest | Error.DatasetStoreError | Error.MetadataDbError;
/**
 * Error type for the `getDatasetVersion` endpoint.
 *
 * - InvalidRequest: Invalid namespace, name, or revision in path parameters.
 * - DatasetNotFound: The dataset or revision was not found.
 * - DatasetStoreError: Failed to load dataset from store.
 * - MetadataDbError: Database error while retrieving dataset information.
 */
export type GetDatasetVersionError = Error.InvalidRequest | Error.DatasetNotFound | Error.DatasetStoreError | Error.MetadataDbError;
/**
 * Error type for the `deployDataset` endpoint.
 *
 * - InvalidRequest: Invalid path parameters or request body.
 * - DatasetNotFound: The dataset or revision was not found.
 * - DatasetStoreError: Failed to load dataset from store.
 * - SchedulerError: Failed to schedule the deployment job.
 * - MetadataDbError: Database error while scheduling job.
 */
export type DeployDatasetError = Error.InvalidRequest | Error.DatasetNotFound | Error.DatasetStoreError | Error.SchedulerError | Error.MetadataDbError;
/**
 * Error type for the `getDatasetManifest` endpoint.
 *
 * - InvalidRequest: Invalid namespace, name, or revision in path parameters.
 * - DatasetNotFound: The dataset, revision, or manifest was not found.
 * - DatasetStoreError: Failed to read manifest from store.
 * - MetadataDbError: Database error while retrieving manifest path.
 */
export type GetDatasetManifestError = Error.InvalidRequest | Error.DatasetNotFound | Error.DatasetStoreError | Error.MetadataDbError;
/**
 * Error type for the `getJobById` endpoint.
 *
 * - InvalidJobId: The provided ID is not a valid job identifier.
 * - JobNotFound: No job exists with the given ID.
 * - MetadataDbError: Internal database error occurred.
 */
export type GetJobByIdError = Error.InvalidJobId | Error.JobNotFound | Error.MetadataDbError;
/**
 * Error type for the `getOutputSchema` endpoint.
 *
 * - DatasetStoreError: Failure in dataset storage operations.
 * - PlanningError: Query planning or schema inference failure.
 * - CatalogForSqlError: Failed to build catalog for SQL query.
 */
export type GetOutputSchemaError = Error.DatasetStoreError | Error.PlanningError | Error.CatalogForSqlError;
declare const DatasetGroup_base: HttpApiGroup.HttpApiGroup<"dataset", HttpApiEndpoint.HttpApiEndpoint<"registerDataset", "POST", never, never, {
    readonly name: string;
    readonly manifest: Model.DatasetDerived | Model.DatasetEvmRpc | Model.DatasetEthBeacon | Model.DatasetFirehose;
    readonly namespace: string;
    readonly version?: string | undefined;
}, never, void, Error.InvalidManifest | Error.ManifestRegistrationError | Error.ManifestLinkingError | Error.VersionTaggingError | Error.DependencyValidationError | Error.UnsupportedDatasetKind | Error.ManifestNotFound | Error.InvalidPayloadFormat | Error.StoreError, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getDatasets", "GET", never, never, never, never, Model.DatasetsResponse, Error.MetadataDbError | Error.DatasetStoreError, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getDatasetVersions", "GET", {
    readonly namespace: string;
    readonly name: string;
}, never, never, never, Model.DatasetVersionsResponse, Error.MetadataDbError | Error.DatasetStoreError | Error.InvalidRequest, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getDatasetVersion", "GET", {
    readonly namespace: string;
    readonly name: string;
    readonly revision: string;
}, never, never, never, Model.DatasetVersionInfo, Error.MetadataDbError | Error.DatasetStoreError | Error.DatasetNotFound | Error.InvalidRequest, never, never> | HttpApiEndpoint.HttpApiEndpoint<"deployDataset", "POST", {
    readonly namespace: string;
    readonly name: string;
    readonly revision: string;
}, never, Model.DeployRequest, never, Model.DeployResponse, Error.SchedulerError | Error.MetadataDbError | Error.DatasetStoreError | Error.DatasetNotFound | Error.InvalidRequest, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getDatasetManifest", "GET", {
    readonly namespace: string;
    readonly name: string;
    readonly revision: string;
}, never, never, never, Model.DatasetDerived | Model.DatasetEvmRpc | Model.DatasetEthBeacon | Model.DatasetFirehose, Error.MetadataDbError | Error.DatasetStoreError | Error.DatasetNotFound | Error.InvalidRequest, never, never>, never, never, false>;
/**
 * The api group for the dataset endpoints.
 */
export declare class DatasetGroup extends DatasetGroup_base {
}
declare const JobGroup_base: HttpApiGroup.HttpApiGroup<"job", HttpApiEndpoint.HttpApiEndpoint<"getJobById", "GET", {
    readonly jobId: number;
}, never, never, never, Model.JobInfo, Error.MetadataDbError | Error.JobNotFound | Error.InvalidJobId, never, never>, never, never, false>;
/**
 * The api group for the job endpoints.
 */
export declare class JobGroup extends JobGroup_base {
}
declare const SchemaGroup_base: HttpApiGroup.HttpApiGroup<"schema", HttpApiEndpoint.HttpApiEndpoint<"getOutputSchema", "POST", never, never, {
    readonly sqlQuery: string;
    readonly isSqlDataset?: boolean | undefined;
}, never, Model.OutputSchema, Error.DatasetStoreError | Error.PlanningError | Error.CatalogForSqlError, never, never>, never, never, false>;
/**
 * The api group for the schema endpoints.
 */
export declare class SchemaGroup extends SchemaGroup_base {
}
declare const Api_base: HttpApi.HttpApi<"admin", typeof DatasetGroup | typeof JobGroup | typeof SchemaGroup, import("@effect/platform/HttpApiError").HttpApiDecodeError, never>;
/**
 * The api definition for the admin api.
 */
export declare class Api extends Api_base {
}
/**
 * Options for dumping a dataset.
 */
export interface DumpDatasetOptions {
    /**
     * The version of the dataset to dump.
     */
    readonly version?: string | undefined;
    /**
     * The block up to which to dump.
     */
    readonly endBlock?: number | undefined;
}
/**
 * Options for schema retrieval.
 */
export interface GetSchemaOptions {
    /**
     * Whether this is a sql dataset.
     *
     * @default true
     */
    readonly isSqlDataset?: boolean | undefined;
}
declare const Admin_base: Context.TagClass<Admin, "Amp/Admin", {
    /**
     * Register a dataset manifest.
     *
     * @param namespace The namespace of the dataset to register.
     * @param name The name of the dataset to register.
     * @param version Optional version of the dataset to register. If omitted, only the "dev" tag is updated.
     * @param manifest The dataset manifest to register.
     * @return Whether the registration was successful.
     */
    readonly registerDataset: (namespace: Model.DatasetNamespace, name: Model.DatasetName, version: Option.Option<Model.DatasetVersion>, manifest: Model.DatasetManifest) => Effect.Effect<void, HttpClientError.HttpClientError | RegisterDatasetError>;
    /**
     * Get all datasets.
     *
     * @return The list of all datasets.
     */
    readonly getDatasets: () => Effect.Effect<Model.DatasetsResponse, HttpClientError.HttpClientError | GetDatasetsError>;
    /**
     * Get all versions of a specific dataset.
     *
     * @param namespace The namespace of the dataset.
     * @param name The name of the dataset.
     * @return The list of all dataset versions.
     */
    readonly getDatasetVersions: (namespace: Model.DatasetNamespace, name: Model.DatasetName) => Effect.Effect<Model.DatasetVersionsResponse, HttpClientError.HttpClientError | GetDatasetVersionsError>;
    /**
     * Get a specific dataset version.
     *
     * @param namespace The namespace of the dataset.
     * @param name The name of the dataset.
     * @param revision The version/revision of the dataset.
     * @return The dataset version information.
     */
    readonly getDatasetVersion: (namespace: Model.DatasetNamespace, name: Model.DatasetName, revision: Model.DatasetRevision) => Effect.Effect<Model.DatasetVersionInfo, HttpClientError.HttpClientError | GetDatasetVersionError>;
    /**
     * Deploy a dataset version.
     *
     * @param namespace The namespace of the dataset.
     * @param name The name of the dataset to deploy.
     * @param revision The version/revision to deploy.
     * @param options The deployment options.
     * @return The deployment response with job ID.
     */
    readonly deployDataset: (namespace: Model.DatasetNamespace, name: Model.DatasetName, revision: Model.DatasetRevision, options?: {
        endBlock?: string | null | undefined;
        parallelism?: number | undefined;
    } | undefined) => Effect.Effect<Model.DeployResponse, HttpClientError.HttpClientError | DeployDatasetError>;
    /**
     * Get the manifest for a dataset version.
     *
     * @param namespace The namespace of the dataset.
     * @param name The name of the dataset.
     * @param revision The version/revision of the dataset.
     * @return The dataset manifest.
     */
    readonly getDatasetManifest: (namespace: Model.DatasetNamespace, name: Model.DatasetName, revision: Model.DatasetRevision) => Effect.Effect<any, HttpClientError.HttpClientError | GetDatasetManifestError>;
    /**
     * Get a job by ID.
     *
     * @param jobId The ID of the job to get.
     * @return The job information.
     */
    readonly getJobById: (jobId: number) => Effect.Effect<Model.JobInfo, HttpClientError.HttpClientError | GetJobByIdError>;
    /**
     * Gets the schema of a dataset.
     *
     * @param sql - The SQL query to get the schema for.
     * @param options - Options for the schema retrieval.
     * @returns An effect that resolves to the table schema.
     */
    readonly getOutputSchema: (sql: string, options?: GetSchemaOptions) => Effect.Effect<Model.OutputSchema, HttpClientError.HttpClientError | GetOutputSchemaError>;
}>;
/**
 * Service definition for the admin api.
 */
export declare class Admin extends Admin_base {
}
/**
 * Creates an admin api service instance.
 *
 * @param url - The url of the admin api service.
 * @returns An admin api service instance.
 */
export declare const make: (url: string) => Effect.Effect<{
    registerDataset: (namespace: string, name: string, version: Option.Option<string>, manifest: Model.DatasetDerived | Model.DatasetEvmRpc | Model.DatasetEthBeacon | Model.DatasetFirehose) => Effect.Effect<void, HttpClientError.HttpClientError | Error.InvalidManifest | Error.ManifestRegistrationError | Error.ManifestLinkingError | Error.VersionTaggingError | Error.DependencyValidationError | Error.UnsupportedDatasetKind | Error.ManifestNotFound | Error.InvalidPayloadFormat | Error.StoreError, never>;
    getDatasets: () => Effect.Effect<Model.DatasetsResponse, HttpClientError.HttpClientError | Error.MetadataDbError | Error.DatasetStoreError, never>;
    getDatasetVersions: (namespace: string, name: string) => Effect.Effect<Model.DatasetVersionsResponse, HttpClientError.HttpClientError | Error.MetadataDbError | Error.DatasetStoreError | Error.InvalidRequest, never>;
    getDatasetVersion: (namespace: string, name: string, revision: string) => Effect.Effect<Model.DatasetVersionInfo, HttpClientError.HttpClientError | Error.MetadataDbError | Error.DatasetStoreError | Error.DatasetNotFound | Error.InvalidRequest, never>;
    deployDataset: (namespace: string, name: string, revision: string, options?: {
        endBlock?: string | null | undefined;
        parallelism?: number | undefined;
    } | undefined) => Effect.Effect<Model.DeployResponse, HttpClientError.HttpClientError | Error.SchedulerError | Error.MetadataDbError | Error.DatasetStoreError | Error.DatasetNotFound | Error.InvalidRequest, never>;
    getDatasetManifest: (namespace: string, name: string, revision: string) => Effect.Effect<Model.DatasetDerived | Model.DatasetEvmRpc | Model.DatasetEthBeacon | Model.DatasetFirehose, HttpClientError.HttpClientError | Error.MetadataDbError | Error.DatasetStoreError | Error.DatasetNotFound | Error.InvalidRequest, never>;
    getJobById: (jobId: number) => Effect.Effect<Model.JobInfo, HttpClientError.HttpClientError | Error.MetadataDbError | Error.JobNotFound | Error.InvalidJobId, never>;
    getOutputSchema: (sql: string, options?: GetSchemaOptions | undefined) => Effect.Effect<Model.OutputSchema, HttpClientError.HttpClientError | Error.DatasetStoreError | Error.PlanningError | Error.CatalogForSqlError, never>;
}, never, import("@effect/platform/HttpClient").HttpClient>;
/**
 * Creates a layer for the admin api service.
 *
 * @param url - The url of the admin api service.
 * @returns A layer for the admin api service.
 */
export declare const layer: (url: string) => Layer.Layer<Admin, never, never>;
export {};
//# sourceMappingURL=Admin.d.ts.map