import { Equal, FastCheck, Hash, Schema } from "effect";
import * as CBOR from "./CBOR.js";
import * as DatumHash from "./DatumHash.js";
declare const DataError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
    readonly _tag: "DataError";
} & Readonly<A>;
/**
 * Error class for Data related operations.
 *
 * @since 2.0.0
 * @category errors
 */
export declare class DataError extends DataError_base<{
    message?: string;
    cause?: unknown;
}> {
}
/**
 * PlutusData encoded type (for JSON/CBOR encoding)
 * Based on Conway CDDL specification
 *
 * @since 2.0.0
 * @category model
 */
export type DataEncoded = {
    readonly index: string;
    readonly fields: ReadonlyArray<DataEncoded>;
} | ReadonlyArray<readonly [DataEncoded, DataEncoded]> | ReadonlyArray<DataEncoded> | string | string;
/**
 * PlutusData type definition (runtime type)
 * Based on Conway CDDL specification
 *
 * ```
 * CDDL: plutus_data =
 *   constr<plutus_data>
 *   / {* plutus_data => plutus_data}
 *   / [* plutus_data]
 *   / big_int
 *   / bounded_bytes
 *
 * constr<a0> =
 *   #6.121([* a0])
 *   / #6.122([* a0])
 *   / #6.123([* a0])
 *   / #6.124([* a0])
 *   / #6.125([* a0])
 *   / #6.126([* a0])
 *   / #6.127([* a0])
 *   / #6.102([uint, [* a0]])
 * ```
 *
 * Constructor Index Limits:
 * - Tags 121-127: Direct encoding for constructor indices 0-6
 * - Tag 102: General constructor encoding for any uint value
 * - Maximum constructor index: 2^64 - 1 (18,446,744,073,709,551,615)
 *   as per CBOR RFC 8949 specification for unsigned integers
 *
 * @since 2.0.0
 * @category model
 */
export type Data = Constr | globalThis.Map<Data, Data> | ReadonlyArray<Data> | bigint | Uint8Array;
/**
 * PlutusMap type alias
 *
 * @since 2.0.0
 * @category model
 */
export type Map = globalThis.Map<Data, Data>;
/**
 * PlutusList type alias
 *
 * @since 2.0.0
 * @category model
 */
export type List = ReadonlyArray<Data>;
declare const Constr_base: Schema.Class<Constr, {
    index: Schema.refine<bigint, typeof Schema.BigInt>;
    fields: Schema.Array$<Schema.suspend<Data, DataEncoded, never>>;
}, Schema.Struct.Encoded<{
    index: Schema.refine<bigint, typeof Schema.BigInt>;
    fields: Schema.Array$<Schema.suspend<Data, DataEncoded, never>>;
}>, never, {
    readonly fields: readonly Data[];
} & {
    readonly index: bigint;
}, {}, {}>;
/**
 * Constr schema for constructor alternatives
 *
 * @category schemas
 * @since 2.0.0
 */
export declare class Constr extends Constr_base {
    [Equal.symbol](that: unknown): boolean;
    [Hash.symbol](): number;
}
/**
 * Schema for PlutusMap data type
 *
 * @category schemas
 *
 * @since 2.0.0
 */
export declare const MapSchema: Schema.transform<Schema.Array$<Schema.Tuple2<Schema.suspend<Data, DataEncoded, never>, Schema.suspend<Data, DataEncoded, never>>>, Schema.MapFromSelf<Schema.SchemaClass<Data, Data, never>, Schema.SchemaClass<Data, Data, never>>>;
/**
 * Schema for PlutusList data type
 *
 * @category schemas
 *
 * @since 2.0.0
 */
export declare const ListSchema: Schema.Array$<Schema.suspend<Data, DataEncoded, never>>;
/**
 * Schema for PlutusBigInt data type
 *
 * Matches the CDDL specification for big_int:
 * ```
 * big_int = int / big_uint / big_nint
 * big_uint = #6.2(bounded_bytes)
 * big_nint = #6.3(bounded_bytes)
 * ```
 *
 * Where:
 * - `int` covers integers that fit in CBOR major types 0 and 1 (0 to 2^64-1 for positive, -(2^64-1) to -1 for negative)
 * - `big_uint` (tag 2) covers positive integers larger than 2^64-1
 * - `big_nint` (tag 3) covers negative integers smaller than -(2^64-1)
 *
 * Note: JavaScript's Number.MAX_SAFE_INTEGER (2^53-1) is much smaller than CBOR's 64-bit limit.
 *
 * @category schemas
 *
 * @since 2.0.0
 */
export declare const IntSchema: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.BigIntFromSelf, never>;
export type Int = typeof IntSchema.Type;
/**
 * Schema for PlutusBytes data type
 *
 * @category schemas
 *
 * @since 2.0.0
 */
export declare const ByteArray: Schema.Schema<Uint8Array<ArrayBufferLike>, string, never>;
export type ByteArray = typeof ByteArray.Type;
export interface DataSchema extends Schema.SchemaClass<Data, DataEncoded> {
}
/**
 * Combined schema for PlutusData type with proper recursion
 *
 * @category schemas
 *
 * @since 2.0.0
 */
export declare const DataSchema: DataSchema;
/**
 * Type guard to check if a value is a Constr
 *
 * @category predicates
 *
 * @since 2.0.0
 */
export declare const isConstr: (data: unknown) => data is Constr;
/**
 * Type guard to check if a value is a PlutusMap
 *
 * @category predicates
 *
 * @since 2.0.0
 */
export declare const isMap: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions | number) => u is globalThis.Map<Data, Data>;
/**
 * Type guard to check if a value is a PlutusList
 *
 * @category predicates
 *
 * @since 2.0.0
 */
export declare const isList: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions | number) => u is readonly Data[];
/**
 * Type guard to check if a value is a PlutusBigInt
 *
 * @category predicates
 *
 * @since 2.0.0
 */
export declare const isInt: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions | number) => u is bigint;
/**
 * Type guard to check if a value is a PlutusBytes
 *
 * @category predicates
 *
 * @since 2.0.0
 */
export declare const isBytes: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions | number) => u is Uint8Array<ArrayBufferLike>;
/**
 * Creates a constructor with the specified index and data
 *
 * @since 2.0.0
 * @category constructors
 */
export declare const constr: (index: bigint, fields: Array<Data>) => Constr;
/**
 * Creates a Plutus map from key-value pairs
 *
 * @since 2.0.0
 * @category constructors
 */
export declare const map: (entries: Array<[key: Data, value: Data]>) => Map;
/**
 * Creates a Plutus list from items
 *
 * @since 2.0.0
 * @category constructors
 */
export declare const list: (list: Array<Data>) => List;
/**
 * Creates Plutus big integer
 *
 * @since 2.0.0
 * @category constructors
 */
export declare const int: (integer: bigint) => Int;
/**
 * Creates Plutus bounded bytes from hex string
 *
 * @since 2.0.0
 * @category constructors
 */
export declare const bytearray: (bytes: string) => ByteArray;
/**
 * Pattern matching helper for Constr types
 *
 * @since 2.0.0
 * @category utilities
 */
export declare const matchConstr: <T>(constr: Constr, cases: {
    [key: number]: (fields: ReadonlyArray<Data>) => T;
    _: (index: number, fields: ReadonlyArray<Data>) => T;
}) => T;
/**
 * Pattern matching helper for PlutusData types
 *
 * @since 2.0.0
 * @category utilities
 */
export declare const matchData: <T>(data: Data, cases: {
    Map: (entries: ReadonlyArray<[Data, Data]>) => T;
    List: (items: ReadonlyArray<Data>) => T;
    Int: (value: bigint) => T;
    Bytes: (bytes: Uint8Array) => T;
    Constr: (constr: Constr) => T;
}) => T;
/**
 * Creates an arbitrary that generates PlutusData values with controlled depth
 *
 * @category generators
 *
 * @since 2.0.0
 */
export declare const arbitraryPlutusData: (depth?: number) => FastCheck.Arbitrary<Data>;
/**
 * Creates an arbitrary that generates PlutusBytes values
 *
 * @category generators
 *
 * @since 2.0.0
 */
export declare const arbitraryPlutusBytes: () => FastCheck.Arbitrary<Uint8Array>;
/**
 * Creates an arbitrary that generates PlutusBigInt values
 *
 * @category generators
 *
 * @since 2.0.0
 */
export declare const arbitraryPlutusBigInt: () => FastCheck.Arbitrary<bigint>;
/**
 * Creates an arbitrary that generates PlutusList values
 *
 * @category generators
 *
 * @since 2.0.0
 */
export declare const arbitraryPlutusList: (depth: number) => FastCheck.Arbitrary<List>;
/**
 * Creates an arbitrary that generates Constr values
 *
 * @category generators
 *
 * @since 2.0.0
 */
export declare const arbitraryConstr: (depth: number) => FastCheck.Arbitrary<Constr>;
/**
 * Creates an arbitrary that generates PlutusMap values with unique keys
 * Following a similar distribution pattern:
 * - 60% PlutusBigInt keys
 * - 30% PlutusBytes keys
 * - 10% Complex keys
 *
 * @category generators
 *
 * @since 2.0.0
 */
export declare const arbitraryPlutusMap: (depth: number) => FastCheck.Arbitrary<Map>;
/**
 * FastCheck arbitrary for PlutusData types
 *
 * @since 2.0.0
 * @category generators
 */
export declare const arbitrary: FastCheck.Arbitrary<Data>;
/**
 * Default CBOR options for Data encoding/decoding
 *
 * @since 2.0.0
 * @category constants
 */
export declare const DEFAULT_CBOR_OPTIONS: CBOR.CodecOptions;
/**
 * Convert PlutusData to CBORValue
 *
 * @since 2.0.0
 * @category transformation
 */
export declare const plutusDataToCBORValue: (data: Data) => CBOR.CBOR;
/**
 * Convert CBORValue to PlutusData
 *
 * @since 2.0.0
 * @category transformation
 */
export declare const cborValueToPlutusData: (cborValue: CBOR.CBOR) => Data;
/**
 * Deep structural hash for Plutus Data values.
 * Handles maps, lists, ints, bytes, and constrs.
 *
 * @since 2.0.0
 * @category equality
 */
export declare const hash: (data: Data) => number;
/**
 * Schema-derived structural equality for Plutus Data values.
 * Handles maps, lists, ints, bytes, and constrs via the
 * recursive DataSchema definition — no hand-rolled comparison needed.
 *
 * @since 2.0.0
 * @category equality
 */
export declare const equals: (a: Data, b: Data) => boolean;
export declare const CDDLSchema: Schema.Schema<CBOR.CBOR, CBOR.CBOR, never>;
/**
 * CDDL schema for PlutusData following the Conway specification.
 *
 * ```
 * plutus_data =
 *   constr<plutus_data>
 *   / {* plutus_data => plutus_data}
 *   / [* plutus_data]
 *   / big_int
 *   / bounded_bytes
 *
 * constr<a0> =
 *   #6.121([* a0])    // index 0
 *   / #6.122([* a0])  // index 1
 *   / #6.123([* a0])  // index 2
 *   / #6.124([* a0])  // index 3
 *   / #6.125([* a0])  // index 4
 *   / #6.126([* a0])  // index 5
 *   / #6.127([* a0])  // index 6
 *   / #6.102([uint, [* a0]])  // general constructor
 *
 * big_int = int / big_uint / big_nint
 * big_uint = #6.2(bounded_bytes)
 * big_nint = #6.3(bounded_bytes)
 * ```
 *
 * This transforms between CBOR values and PlutusData using the existing
 * plutusDataToCBORValue and cborValueToPlutusData functions.
 *
 * @since 2.0.0
 * @category schemas
 */
export declare const FromCDDL: Schema.transformOrFail<Schema.Schema<CBOR.CBOR, CBOR.CBOR, never>, Schema.SchemaClass<Data, Data, never>, never>;
/**
 * CBOR bytes transformation schema for PlutusData using CDDL.
 * Transforms between CBOR bytes and Data using CDDL encoding.
 *
 * @since 2.0.0
 * @category schemas
 */
export declare const FromCBORBytes: (options?: CBOR.CodecOptions) => Schema.transform<Schema.transformOrFail<typeof Schema.Uint8ArrayFromSelf, Schema.declare<CBOR.CBOR, CBOR.CBOR, readonly [], never>, never>, Schema.transformOrFail<Schema.Schema<CBOR.CBOR, CBOR.CBOR, never>, Schema.SchemaClass<Data, Data, never>, never>>;
/**
 * CBOR hex transformation schema for PlutusData using CDDL.
 * Transforms between CBOR hex string and Data using CDDL encoding.
 *
 * @since 2.0.0
 * @category schemas
 */
export declare const FromCBORHex: (options?: CBOR.CodecOptions) => Schema.transform<Schema.Schema<Uint8Array<ArrayBufferLike>, string, never>, Schema.transform<Schema.transformOrFail<typeof Schema.Uint8ArrayFromSelf, Schema.declare<CBOR.CBOR, CBOR.CBOR, readonly [], never>, never>, Schema.transformOrFail<Schema.Schema<CBOR.CBOR, CBOR.CBOR, never>, Schema.SchemaClass<Data, Data, never>, never>>>;
/**
 * Encode PlutusData to CBOR bytes
 *
 * @since 2.0.0
 * @category transformation
 */
export declare const toCBORBytes: (data: Data, options?: CBOR.CodecOptions) => Uint8Array<ArrayBufferLike>;
/**
 * Encode PlutusData to CBOR hex string
 *
 * @since 2.0.0
 * @category transformation
 */
export declare const toCBORHex: (data: Data, options?: CBOR.CodecOptions) => string;
/**
 * Decode PlutusData from CBOR bytes
 *
 * @since 2.0.0
 * @category transformation
 */
export declare const fromCBORBytes: (bytes: Uint8Array, options?: CBOR.CodecOptions) => Data;
/**
 * Decode PlutusData from CBOR hex string
 *
 * @since 2.0.0
 * @category transformation
 */
export declare const fromCBORHex: (hex: string, options?: CBOR.CodecOptions) => Data;
/**
 * Create a schema that transforms from a custom type to Data and provides CBOR encoding
 *
 * @since 2.0.0
 * @category combinators
 */
export declare const withSchema: <A, I extends Data>(schema: Schema.Schema<A, I>, options?: CBOR.CodecOptions) => {
    toData: (a: A, overrideOptions?: import("effect/SchemaAST").ParseOptions) => I;
    fromData: (i: I, overrideOptions?: import("effect/SchemaAST").ParseOptions) => A;
    toCBORHex: (a: A, overrideOptions?: import("effect/SchemaAST").ParseOptions) => string;
    toCBORBytes: (a: A, overrideOptions?: import("effect/SchemaAST").ParseOptions) => Uint8Array<ArrayBufferLike>;
    fromCBORHex: (i: string, overrideOptions?: import("effect/SchemaAST").ParseOptions) => A;
    fromCBORBytes: (i: Uint8Array<ArrayBufferLike>, overrideOptions?: import("effect/SchemaAST").ParseOptions) => A;
};
/**
 * Compute the hash of PlutusData using blake2b-256 over its CBOR encoding.
 * Defaults to CML_DATA_DEFAULT_OPTIONS (indefinite-length arrays/maps).
 *
 * @since 2.0.0
 * @category hashing
 * @example
 * ```typescript
 * import * as Data from "@evolution-sdk/evolution/Data"
 *
 * // Hash a simple integer
 * const intData = 42n
 * const intHash = Data.toDatumHash(intData)
 *
 * // Hash a constructor
 * const constr = new Data.Constr({ index: 0n, fields: [1n, 2n] })
 * const constrHash = Data.toDatumHash(constr)
 *
 * // Hash a bytearray
 * const bytes = new Uint8Array([0xde, 0xad, 0xbe, 0xef])
 * const bytesHash = Data.toDatumHash(bytes)
 * ```
 */
export declare const toDatumHash: (data: Data, options?: CBOR.CodecOptions) => DatumHash.DatumHash;
/**
 * @since 2.0.0
 * @category hashing
 * @deprecated Use `toDatumHash` instead.
 */
export declare const hashData: (data: Data, options?: CBOR.CodecOptions) => DatumHash.DatumHash;
export {};
//# sourceMappingURL=Data.d.ts.map