import { CacheConfig } from "./types.cjs";
import { Cache, MutationOption } from "./cache.cjs";
import { entityKind } from "../../entity.cjs";
import * as effect_Cause0 from "effect/Cause";
import * as Context from "effect/Context";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as Schema$1 from "effect/Schema";

//#region src/cache/core/cache-effect.d.ts
interface EffectCacheShape {
  readonly strategy: () => 'explicit' | 'all';
  readonly get: (key: string, tables: string[], isTag: boolean, isAutoInvalidate?: boolean) => Effect.Effect<any[] | undefined, EffectCacheError, never>;
  readonly put: (hashedQuery: string, response: any, tables: string[], isTag: boolean, config?: CacheConfig) => Effect.Effect<void, EffectCacheError, never>;
  readonly onMutate: (params: MutationOption) => Effect.Effect<void, EffectCacheError, never>;
  /** Container for async cache if made by wrapping one */
  readonly cache?: Cache;
}
declare const EffectCache_base: Context.ServiceClass<EffectCache, "drizzle-orm/EffectCache", EffectCacheShape> & {
  readonly make: Effect.Effect<EffectCacheShape, never, never>;
};
/**
 * Effect service for caching query results in Drizzle ORM.
 *
 * By default, this service uses a no-op cache (no caching occurs). Use
 * `EffectCache.fromDrizzle` to adapt a standard Drizzle cache implementation.
 *
 * @example
 * ```ts
 * // Use default (no caching)
 * const db = yield* PgDrizzle.make({ relations }).pipe(
 *   Effect.provide(PgDrizzle.DefaultServices),
 * );
 *
 * // Use a custom Drizzle cache
 * const db = yield* PgDrizzle.make({ relations }).pipe(
 *   Effect.provide(EffectCache.layerFromDrizzle(myCache)),
 *   Effect.provide(PgDrizzle.DefaultServices),
 * );
 * ```
 */
declare class EffectCache extends EffectCache_base {
  static readonly [entityKind]: string;
  /**
   * The default layer providing a no-op cache.
   */
  static readonly Default: Layer.Layer<EffectCache, never, never>;
  /**
   * Creates an EffectCacheShape from a standard Drizzle cache.
   *
   * @param cache - A Drizzle cache instance implementing the `Cache` interface.
   * @returns A new EffectCacheShape that delegates to the provided Drizzle cache.
   *
   * @example
   * ```ts
   * const drizzleCache = new MyCustomCache();
   * const effectCache = EffectCache.fromDrizzle(drizzleCache);
   * ```
   */
  static fromDrizzle(cache: Cache): EffectCacheShape;
  /**
   * Creates a Layer that provides an EffectCache from a standard Drizzle cache.
   *
   * @param cache - A Drizzle cache instance implementing the `Cache` interface.
   * @returns A Layer that provides the EffectCache service.
   *
   * @example
   * ```ts
   * const drizzleCache = new MyCustomCache();
   * const db = yield* PgDrizzle.make({ relations }).pipe(
   *   Effect.provide(EffectCache.layerFromDrizzle(drizzleCache)),
   *   Effect.provide(PgDrizzle.DefaultServices),
   * );
   * ```
   */
  static layerFromDrizzle(cache: Cache): Layer.Layer<EffectCache, never, never>;
}
declare const EffectCacheError_base: Schema$1.Class<EffectCacheError, Schema$1.TaggedStruct<"EffectCacheError", {
  readonly cause: Schema$1.Unknown;
}>, effect_Cause0.YieldableError>;
/**
 * Error type for cache operation failures.
 *
 * This error is thrown when any cache operation (get, put, onMutate) fails.
 * The original error is available in the `cause` property.
 */
declare class EffectCacheError extends EffectCacheError_base {
  static readonly [entityKind]: string;
}
//#endregion
export { EffectCache, EffectCacheError, EffectCacheShape };
//# sourceMappingURL=cache-effect.d.cts.map