import { HttpParams } from "@angular/common/http";
import { Observable } from "rxjs";
import { JsonRpcRequest, JsonRpcResponse } from "../util/net/JsonRpc";
import { DwColumnProperties, TableColumn } from "./TableColumn";
import { TableParam } from "./TableParam";
export type DwStyle = "Grid" | "Form" | "Card" | "Graph";
export type BufferType = "Primary!" | "Delete!" | "Filter!";
export type ItemStatus = "DataModified!" | "New!" | "NewModified!" | "NotModified!";
export type SaveAsType = "Text!" | "CSV!" | "XML!" | "JSON!";
export declare enum UpdateWhereClause {
    KeyCols = 0,
    KeyAndUpdatableCols = 1,
    KeyAndModifiedCols = 2
}
export type RpcMethodContext = {
    baseUrl?: string;
    dwCode?: string;
};
export type SelectMethodSignature<T = any[]> = (params?: HttpParams, context?: RpcMethodContext) => Observable<T | JsonRpcResponse>;
export type RpcMethodSignature = (body: JsonRpcRequest | JsonRpcRequest[], context?: RpcMethodContext) => Observable<JsonRpcResponse | JsonRpcResponse[]>;
export type DwExpression = string;
export type DwAlignmentMode = "left" | "center" | "right" | "justify";
export type DwBandType = "detail" | "footer" | "header" | "header.1" | "header.2" | "header.3" | "summary" | "trailer.1" | "trailer.2" | "trailer.3" | "tree.level.1" | "tree.level.2" | "tree.level.3" | "foreground" | "background";
export type DwButtonAction = "None!" | "Sort!" | "Filter!" | "Print!" | "InsertRow!" | "DeleteRow!" | "EditRow!";
export type DwCharCase = "any" | "upper" | "lower";
export type DwControlType = "column" | "compute" | "button" | "hyperlink" | "bitmap" | "graph" | "tableblob";
export type DwContentType = "color" | "email" | "file" | "image" | "month" | "tel" | "url" | "week";
export type DwDisplayStyle = "default" | "picture" | "button" | "hyperlink" | "chiplist";
export type DwStickyPosition = "left" | "right";
export type DwBandProperties = {
    height?: number;
    $style?: DwExpression;
};
export type DwPaginatorProperties = {
    pageSize?: number;
    showFirstLastPage?: boolean;
    pageSizeOptions?: number[];
};
/** Column edit styles */
export type ChipListStyle = {
    name: "chiplist";
    allowedit?: boolean;
    charcase?: DwCharCase;
    limit?: number;
    nillisnull?: boolean;
    sorted?: boolean;
    vscrollbar?: boolean;
    placeholder?: string;
};
export type EditStyle = {
    name: "edit";
    autohscroll?: boolean;
    autocomplete?: boolean;
    autoselect?: boolean;
    autovscroll?: boolean;
    charcase?: DwCharCase;
    readonly?: boolean;
    format?: string;
    limit?: number;
    nillisnull?: boolean;
    password?: boolean;
    validatecode?: boolean;
    placeholder?: string;
};
export type EditMaskStyle = {
    name: "editmask";
    autoskip?: boolean;
    codetable?: boolean;
    spin?: boolean;
    spinincr?: number;
    spinrange?: [any, any];
    mask?: string;
    useformat?: boolean;
    placeholder?: string;
};
export type DDLBStyle = {
    name: "ddlb";
    allowedit?: boolean;
    charcase?: DwCharCase;
    limit?: number;
    nillisnull?: boolean;
    sorted?: boolean;
    vscrollbar?: boolean;
    placeholder?: string;
};
export type DDPLBStyle = {
    name: "ddplb";
    allowedit?: boolean;
    charcase?: DwCharCase;
    limit?: number;
    nillisnull?: boolean;
    sorted?: boolean;
    vscrollbar?: boolean;
    placeholder?: string;
};
export type DDDWStyle = {
    name: "dddw";
    allowedit?: boolean;
    autohscroll?: boolean;
    autoretrieve?: boolean;
    ctor?: any;
    datacolumn?: string;
    displaycolumn?: string;
    charcase?: DwCharCase;
    hscrollbar?: boolean;
    lines?: number;
    limit?: number;
    nullisnull?: boolean;
    percentwidth?: number;
    vscrollbar?: boolean;
    useasborder?: boolean;
    placeholder?: string;
};
export type CheckBoxStyle = {
    name: "checkbox";
    on?: any;
    off?: any;
    other?: any;
    threestates?: boolean;
    lefttext?: boolean;
};
export type RadioButtonsStyle = {
    name: "radiobuttons";
    lefttext?: boolean;
    columns?: number;
};
export type RichEditStyle = {
    name: "richedit";
    autoselect?: boolean;
    displayonly?: boolean;
    limit?: number;
    nillisnull?: boolean;
    vscrollbar?: boolean;
};
export type DwEditStyle = EditStyle | EditMaskStyle | DDLBStyle | DDPLBStyle | DDDWStyle | ChipListStyle | CheckBoxStyle | RadioButtonsStyle | RichEditStyle;
export interface DwControlProperties {
    /** Type of DataWindow/DataStore control. Required. */
    type: DwControlType;
    /** The band or layer in the DataWindow object that contains the control */
    band?: DwBandType;
    /** Table/Grid column header. Default is Control's name. */
    header?: string;
    /** Form's control label. Default is Control's name. */
    label?: string;
    /** Some descriptive text (hint) */
    microhelp?: string;
    /** Reference to the Table `Column` object for controls with column's type value. _Null_ for others.  */
    column?: TableColumn | null;
    /** The datatype of the column or computed field.*/
    coltype?: string;
    /** The type of the content that this control should contain */
    content?: DwContentType;
    /** Style of the UI element that will be applied when the parent row will be in the edit/insert state */
    editstyle?: DwEditStyle;
    /** How to display this control? */
    displayas?: DwDisplayStyle;
    /** Control's expression. Required for computed items. */
    expression?: string;
    /** Whether this control is required in the edit form. Default is _false_. */
    required?: boolean;
    /** When a column is protected, the user cannot edit it even if the column's tab order is equal or greater than 0. */
    protect?: DwExpression | boolean;
    /** Whether the specified control in the DataWindow is visible. Default is _true_. */
    visible?: DwExpression | boolean;
    /** Whether the specified control in the DataWindow is sortable. Default is _true_.*/
    sortable?: boolean;
    /** Whether this control in the DataWindow is resizeable. Default is _true_. */
    resizeable?: boolean;
    /** Whether this control in the DataWindow is moveable. */
    moveable?: boolean;
    summable?: boolean;
    action?: DwExpression | DwButtonAction;
    badge?: DwExpression;
    badgecolor?: DwExpression;
    /** Icon name, for example material icon */
    icon?: DwExpression;
    /** CSS style expression */
    $style?: DwExpression;
    /** CSS class expression */
    $class?: DwExpression;
    /** Color palette */
    palette?: DwExpression;
    /** */
    role?: "title" | "subtitle" | "avatar";
    /** Horizontal alignment */
    alignment?: DwAlignmentMode;
    /** Sticky position */
    sticky?: DwStickyPosition;
    /** Width in pixels */
    width?: number;
    /** Width in the _Form_ style in pixels */
    format?: string;
    cursor?: string;
    /** Any value you need for this control. */
    tag?: any;
}
export type DwObject = {
    name: string;
} & DwControlProperties;
export type DwGridStyleOptions = {
    lines?: 0 | 1 | 2 | 3;
    selection?: boolean;
    columnMove?: boolean;
};
export interface DwGeneralOptions {
    code?: string;
    name?: string;
    /** DataWindow's presentation style */
    style?: DwStyle;
    /** Internal timer interval */
    timer?: number;
    /** Grid options */
    grid?: DwGridStyleOptions;
    /** Header of Table */
    thead?: DwBandProperties;
    /** Body of Table */
    tbody?: DwBandProperties;
    /** Footer of Table */
    tfoot?: DwBandProperties;
    /** Group headers */
    ghead?: DwBandProperties[];
    /** Group footers */
    gfoot?: DwBandProperties[];
    /** Is DataWindow readonly? */
    readonly?: boolean;
    /** Paginator options */
    paginator?: DwPaginatorProperties;
}
export interface DwTableOptions {
    /** Table columns definition array. Required  */
    columns: TableColumn[] | {
        [name: string]: DwColumnProperties;
    };
    /** Query parameters for the data selection */
    parameters?: TableParam[];
    /** Start data filter expression */
    startFilter?: DwExpression;
    /** Start data sort condition */
    startSort?: string;
    /** Array of the group levels' expressions */
    groups?: DwExpression[];
    /** A string specifying the name of the database table used to build the Update syntax. If it undefined DataStore is not updatable. */
    updateTable?: string;
    /** A string specifying the alias of the database table used to build the Update syntax. Default is a value of *updateTable* */
    updateAlias?: string;
    /** An integer indicating which columns will be included in the **WHERE** clause of the Update statement. Default is **0**. */
    updateWhere?: UpdateWhereClause;
    /** Whether the key column can be updated in place or the row has to be deleted and reinserted. Default is *true*. */
    updateKeyInPlace?: boolean;
    /** Whether the insert/update commands should return current values of ALL columns from the backend. Default is *false* */
    returningAllFields?: boolean;
    /**
     * Rpc request's `method` format (`action` is one of the _update_|_insert_|_delete_ commands):
     * - `0` - _table_name_`.`_action_. Single request object in the batch array.
     * - `1` - _table_name_`_`_action_. Single request object in the batch array.
     * - `2` - *action***Row** & params: {table: *table_name*, ...}. Single request object in the batch array.
     * - `3` - Only one json-rpc request object in the following format:
     * ```ts
     * //++ pseudo types:
     * type ColumnName  = string;
     * type ValuesMap   = {[key: string]: any};
     * type InsertedRow = {values: ValuesMap, returning?: ColumnName[]|["*"], id:number};
     * type UpdatedRow  = {set: ValuesMap, where: ValuesMap, returning?: ColumnName[]|["*"], id:number};
     * type DeletedRow  = {where: ValuesMap, id:number};
     * //--
     * // Json-rpc request object will be the following:
     * {jsonrpc:"2.0", method:"executeBatch", params:{table:string, inserts:InsertedRow[], updates:UpdatedRow[], deletes:DeletedRow[]}, id:string}
     * //
     * ```
     * *All values of `id`'s are auto generated values. Just send it back to the client unchanged.*
     *
     * Format of the rpc-response's `result` property:
     *
     * ```ts
     * //++ pseudo types:
     * type ActionResult = {sqlnrows?: number, id: number};
     * type RowsDeleted = ActionResult;
     * type RowsUpdated = ActionResult;
     * type RowsInserted = ActionResult;
     * //--
     * {jsonrpc:"2.0", result:{inserts:RowsInserted[], updates:RowsUpdated[], deletes:RowsDeleted[]}, id:string}
     * ```
     */
    rpcMethodFormat?: 0 | 1 | 2 | 3;
    /** Read data function reference */
    selectMethod?: SelectMethodSignature;
    /** Accesses the database to retrieve values for all columns in a row. Result: `{data: [key:string]: any}` */
    reselectRowMethod?: RpcMethodSignature;
    /** Insert rows function reference. Result: `{sqlnrows: number, returning?: [key:string]:any}`  */
    insertMethod?: RpcMethodSignature;
    /** Update rows function reference. Result: `{sqlnrows: number, returning?: [key:string]:any}` */
    updateMethod?: RpcMethodSignature;
    /** Delete rows function reference */
    deleteMethod?: RpcMethodSignature;
    /** Batch update function reference. Result: `{sqlnrows: number, returning?: [key:string]:any}` */
    batchMethod?: RpcMethodSignature;
}
export declare abstract class DataStoreOptions {
    release?: string;
    datawindow?: DwGeneralOptions;
    table?: DwTableOptions;
    controls?: {
        [key: string]: DwControlProperties;
    };
}
export declare const DEFAULT_CONTROL_OPTIONS: DwControlProperties;
export declare const DEFAULT_EDITSTYLE_OPTIONS: EditStyle;
export declare const DEFAULT_EDITMASKSTYLE_OPTIONS: EditMaskStyle;
export declare const DEFAULT_CHIPLISTSTYLE_OPTIONS: ChipListStyle;
export declare const DEFAULT_DDLBSTYLE_OPTIONS: DDLBStyle;
export declare const DEFAULT_DDPLBSTYLE_OPTIONS: DDPLBStyle;
export declare const DEFAULT_DDDWSTYLE_OPTIONS: DDDWStyle;
export declare const DEFAULT_CHECKBOXSTYLE_OPTIONS: CheckBoxStyle;
export declare const DEFAULT_RADIOBUTTONSSTYLE_OPTIONS: RadioButtonsStyle;
export declare const DEFAULT_RICHEDITSTYLE_OPTIONS: RichEditStyle;
