import { Observable } from 'rxjs';
import { ODataApi } from '../api';
import { ModelInterface, ODataCollection, ODataModel } from '../models';
import { ODataStructuredType } from '../schema';
import { ParserOptions, QueryOption, StructuredTypeFieldConfig } from '../types';
import { ODataPathSegments, ODataPathSegmentsHandler } from './path';
import { ODataQueryOptions, ODataQueryOptionsHandler } from './query';
import { ApplyExpression, ApplyExpressionBuilder, QueryCustomType } from './query';
import { ODataOptions } from './types';
import { ODataEntitiesAnnotations, ODataEntityAnnotations } from '../annotations';
export type EntityKey<T> = {
    readonly [P in keyof T]?: T[P];
} | QueryCustomType | string | number;
export declare class ODataResource<T> {
    api: ODataApi;
    protected pathSegments: ODataPathSegments;
    protected queryOptions: ODataQueryOptions<T>;
    constructor(api: ODataApi, { segments, query, }?: {
        segments?: ODataPathSegments;
        query?: ODataQueryOptions<T>;
    });
    /**
     * @returns string The outgoing type of the resource
     */
    outgoingType(): string | undefined;
    /**
     * @returns string The incoming type of the resource
     */
    incomingType(): string | undefined;
    /**
     * @returns string The binding type of the resource
     */
    bindingType(): string | undefined;
    /**
     * @returns string All covered types of the resource
     */
    types(): string[];
    callable(): import("../schema").ODataCallable<T> | undefined;
    enumType(): import("../schema").ODataEnumType<T> | undefined;
    structuredType(): ODataStructuredType<T> | undefined;
    /**
     * @returns boolean The resource has key ?
     */
    hasKey(): boolean;
    hasEntityKey(): boolean;
    clearKey(): void | undefined;
    asModel(entity?: Partial<T> | {
        [name: string]: any;
    }): ODataModel<T> & ModelInterface<T>;
    asModel(entity: Partial<T> | {
        [name: string]: any;
    }, { reset, annots, ModelType, }: {
        reset?: boolean;
        annots?: ODataEntityAnnotations<T>;
        ModelType?: typeof ODataModel;
    }): ODataModel<T> & ModelInterface<T>;
    asModel<M extends ODataModel<T>>(entity?: Partial<T> | {
        [name: string]: any;
    }): M;
    asModel<M extends ODataModel<T>>(entity: Partial<T> | {
        [name: string]: any;
    }, { reset, annots, ModelType, }: {
        reset?: boolean;
        annots?: ODataEntityAnnotations<T>;
        ModelType?: typeof ODataModel;
    }): M;
    asCollection(entities?: Partial<T>[] | {
        [name: string]: any;
    }[]): ODataCollection<T, ODataModel<T> & ModelInterface<T>>;
    asCollection(entities: Partial<T>[] | {
        [name: string]: any;
    }[], { reset, annots, CollectionType, }: {
        reset?: boolean;
        annots?: ODataEntitiesAnnotations<T>;
        CollectionType?: typeof ODataCollection;
    }): ODataCollection<T, ODataModel<T> & ModelInterface<T>>;
    asCollection<M extends ODataModel<T>, C extends ODataCollection<T, M>>(entities?: Partial<T>[] | {
        [name: string]: any;
    }[]): C;
    asCollection<M extends ODataModel<T>, C extends ODataCollection<T, M>>(entities: Partial<T>[] | {
        [name: string]: any;
    }[], { reset, annots, CollectionType, }: {
        reset?: boolean;
        annots?: ODataEntitiesAnnotations<T>;
        CollectionType?: typeof ODataCollection;
    }): C;
    isTypeOf(other: ODataResource<any>): boolean;
    isSubtypeOf(other: ODataResource<any>): boolean;
    isSupertypeOf(other: ODataResource<any>): boolean;
    isEqualTo(other: ODataResource<any>, test?: 'path' | 'params'): boolean;
    pathAndParams({ escape, ...options }?: ParserOptions & {
        escape?: boolean;
    }): [string, {
        [name: string]: any;
    }];
    endpointUrl({ escape, params, ...options }?: ParserOptions & {
        escape?: boolean;
        params?: boolean;
    }): string;
    toString({ escape, ...options }?: ParserOptions & {
        escape?: boolean;
    }): string;
    clone(): ODataResource<T>;
    private __parser;
    deserialize(value: any, options?: ParserOptions): any;
    serialize(value: any, options?: ParserOptions): any;
    encode(value: any, options?: ParserOptions): any;
    toJson(): {
        segments: any[];
        options: {};
    };
    cloneSegments(): ODataPathSegments;
    clearQuery(): this;
    cloneQuery<P>(): ODataQueryOptions<P>;
    /**
     * Handle the path segments of the resource
     * Create an object handler for mutate the path segments of the resource
     * @param f Function context for handle the segments
     * @returns ODataActionResource
     */
    segment(f: (q: ODataPathSegmentsHandler<T>, s?: ODataStructuredType<T>) => void): this;
    /**
     * Handle the query options of the resource
     * Create an object handler for mutate the query options of the resource
     * @param f Function context for handle the query options
     */
    query(f: (q: ODataQueryOptionsHandler<T>, s?: ODataStructuredType<T>) => void): this;
    transform<R>(opts: (builder: ApplyExpressionBuilder<T>, current?: ApplyExpression<T>) => ApplyExpression<T>, { type, fields, }?: {
        type?: string;
        fields?: {
            [name: string]: StructuredTypeFieldConfig;
        };
    }): ODataResource<R>;
    static resolveKey<T>(value: any, schema?: ODataStructuredType<T>): EntityKey<T> | undefined;
    protected resolveKey(value: any): EntityKey<T> | undefined;
    protected get(options?: ODataOptions & {
        etag?: string;
        responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
        withCount?: boolean;
        bodyQueryOptions?: QueryOption[];
    }): Observable<any>;
    protected post(body: any, options?: ODataOptions & {
        responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
        withCount?: boolean;
    }): Observable<any>;
    protected put(body: any, options?: ODataOptions & {
        etag?: string;
        responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
        withCount?: boolean;
    }): Observable<any>;
    protected patch(body: any, options?: ODataOptions & {
        etag?: string;
        responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
        withCount?: boolean;
    }): Observable<any>;
    protected delete(options?: ODataOptions & {
        etag?: string;
        responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
        withCount?: boolean;
    }): Observable<any>;
}
