import { CanonicalLike, ICanonical, ICanonicalSource } from '@darlean/canonical';
import { Class, IFromCanonicalOptions, IValueOptions, Value, ValueClassLike } from './base';
import { NoInfer } from './utils';
type SequenceArray<TElem extends Value> = TElem[];
export declare class SequenceValue<TElem extends Value & ICanonicalSource> extends Value implements ICanonicalSource {
    private _items?;
    private _canonical?;
    static required<T extends SequenceValue<TElem2>, TElem2 extends Value & ICanonicalSource = T extends SequenceValue<infer X> ? X : never>(this: Class<T>): NoInfer<T>;
    static optional<T extends SequenceValue<TElem2>, TElem2 extends Value & ICanonicalSource = T extends SequenceValue<infer X> ? X : never>(this: Class<T>): NoInfer<T>;
    /**
     * Creates a new sequence value from an array of values.
     */
    static from<T extends SequenceValue<TElem2>, TElem2 extends Value & ICanonicalSource = T extends SequenceValue<infer X> ? X : never>(this: Class<T>, value: NoInfer<TElem2>[]): T;
    static fromCanonical<T extends SequenceValue<TElem2>, TElem2 extends Value & ICanonicalSource = T extends SequenceValue<infer X> ? X : never>(this: Class<T>, value: ICanonical, options?: IFromCanonicalOptions): T;
    /**
     * Creates a new sequence value by copying a template value multiple times.
     */
    static fillFrom<T extends SequenceValue<TElem2>, TElem2 extends Value & ICanonicalSource = T extends SequenceValue<infer X> ? X : never>(this: Class<T>, template: NoInfer<TElem2>, repeat: number): T;
    /**
     * Creates a new sequence value by concatenating multiple arrays.
     */
    static concatenateFrom<T extends SequenceValue<TElem2>, TElem2 extends Value & ICanonicalSource = T extends SequenceValue<infer X> ? X : never>(this: Class<T>, ...arrays: (NoInfer<TElem2>[] | SequenceValue<NoInfer<TElem2>>)[]): T;
    /**
     * Creates a new sequence value by mapping existing items.
     */
    static mapFrom<T extends SequenceValue<TElem2>, TSource extends SequenceValue<TSourceElem> | TSourceElem[], TSourceElem extends Value & ICanonicalSource = TSource extends SequenceValue<infer X> ? X : TSource extends (infer Y)[] ? Y : never, TElem2 extends Value & ICanonicalSource = T extends SequenceValue<infer X> ? X : never>(this: Class<T>, source: TSource, mapFunc: (value: TSourceElem, idx: number, arr: TSource) => NoInfer<TElem2>): T;
    /**
     * Creates a new sequence value by sorting the input array.
     * The provided sort func receives values of the element-type for this sequence value.
     * To please typescript, you may need to cast them explicitly to this type via `(a: MyType, b: MyType)`.
     */
    static sortFrom<T extends SequenceValue<TElem2>, TElem2 extends Value & ICanonicalSource = T extends SequenceValue<infer X> ? X : never>(this: Class<T>, source: SequenceValue<NoInfer<TElem2>> | NoInfer<TElem2>[], sortFunc: (a: NoInfer<TElem2>, b: NoInfer<TElem2>) => number): T;
    /**
     * Creates a new sequence value by filtering the input array.
     * The provided sort func receives values of the element-type for this sequence value.
     * To please typescript, you may need to cast them explicitly to this type via `(value: MyType)`.
     */
    static filterFrom<T extends SequenceValue<TElem2>, TElem2 extends Value & ICanonicalSource = T extends SequenceValue<infer X> ? X : never>(this: Class<T>, source: SequenceValue<NoInfer<TElem2>> | NoInfer<TElem2>[], filterFunc: (value: NoInfer<TElem2>) => boolean): T;
    /**
     * Creates a new sequence value by slicing the input array.
     */
    static sliceFrom<T extends SequenceValue<TElem2>, TElem2 extends Value & ICanonicalSource = T extends SequenceValue<infer X> ? X : never>(this: Class<T>, source: SequenceValue<NoInfer<TElem2>> | NoInfer<TElem2>[], start?: number, end?: number): T;
    /**
     * Creates a new sequence value by reversing the input array.
     */
    static reverseFrom<T extends SequenceValue<TElem2>, TElem2 extends Value & ICanonicalSource = T extends SequenceValue<infer X> ? X : never>(this: Class<T>, source: SequenceValue<NoInfer<TElem2>> | NoInfer<TElem2>[]): T;
    /**
     * Creates a new mapping value instance using the provided value.
     * @param value
     */
    constructor(options: IValueOptions);
    get(index: number): TElem | undefined;
    values(): IterableIterator<TElem>;
    _peekCanonicalRepresentation(): ICanonical<this>;
    get _logicalTypes(): string[];
    equals(other: unknown): boolean;
    get length(): number;
    [Symbol.iterator](): Generator<TElem, void, unknown>;
    /**
     * Extracts the current elements. After that, the sequence value should not be
     * used anymore and throws errors when you try to access values.
     */
    extractElements(): SequenceArray<TElem>;
    /**
     * Maps all items to arbitrary other values by means of a mapping function.
     * @param func Function that maps an input value to an output value
     * @returns A native array (not a value object) of mapped items
     */
    map<TResult>(func: (x: TElem, idx: number, array: this) => TResult): TResult[];
    /**
     * Returns a native array with filtered items from this array value.
     * @param func The function that returns true for values that must be included in the resulting array value.
     * @returns A new mapped array value.
     */
    filter(func: (x: TElem) => boolean): TElem[];
    /**
     * Returns an item based on a match function.
     * @param func The function that returns true for the value that must be found.
     * @returns The found value or undefined.
     */
    find(func: (x: TElem) => boolean): TElem | undefined;
    /**
     * Returns the index of an item based on a match function.
     * @param func The function that returns true for the value that must be found.
     * @returns The index of the found value or -1.
     */
    findIndex(func: (x: TElem) => boolean): number;
    /**
     * Returns the index of value, or -1 when not present. Values are compared using `canonical.equals`.
     */
    indexOf(value: CanonicalLike): number;
    /**
     * Returns whether value is present. Values are compared using `canonical.equals`.
     */
    includes(value: CanonicalLike): boolean;
    /**
     * Returns a native array with reverted items from this array value.
     * @returns A new mapped array value.
     */
    reverse(): TElem[];
    /**
     * Returns a native array with sliced items from this array value.
     * @param start The start index (inclusive). Default is 0. When negative, it indicates the offset from the end (-1 corresponds to the last element).
     * @param end The end index (exclusive). Default is input.length. When negative, it indicates the offset from the end (-1 corresponds to the last element).
     * @returns A new sliced array value.
     */
    slice(start?: number, end?: number): TElem[];
    /**
     * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
     * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
     * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
     */
    reduce(callbackfn: (previousValue: TElem, currentValue: TElem, currentIndex: number, array: TElem[]) => TElem): TElem;
    reduce(callbackfn: (previousValue: TElem, currentValue: TElem, currentIndex: number, array: TElem[]) => TElem, initialValue: TElem): TElem;
    /**
     * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
     * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
     * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
     */
    reduce<U>(callbackfn: (previousValue: U, currentValue: TElem, currentIndex: number, array: TElem[]) => U, initialValue: U): U;
    protected _fromCanonical(canonical: ICanonical, options: IFromCanonicalOptions | undefined): (Value & ICanonicalSource)[];
    protected _toCanonical(value: (Value & ICanonicalSource)[], logicalTypes: string[]): ICanonical<this>;
    protected _validate(v: (Value & ICanonicalSource)[], fail: (msg: string) => void): (Value & ICanonicalSource)[] | void;
    protected _deriveCanonicalRepresentation(): ICanonical;
    private _checkItems;
}
export declare function ensureSequenceDefForConstructor<TElem extends Value>(constructor: Function, elemClass: Class<TElem> | (() => Class<TElem>) | undefined): void;
export declare function sequencevalidation<T>(validator: (value: T[]) => string | boolean | void, description?: string): (constructor: Function) => void;
export declare function sequencevalue(elemClass: ValueClassLike, logicalName?: string): (constructor: Function) => void;
export {};
