import { ValidatorFn } from '@angular/forms';
import { Tap, TapResponse } from '@iotize/tap';
import { EnumInfo, TapInfoKey } from '../tap-info/definitions';
import { TapInfo } from '../tap-info/keys';
import { TapInfoHolder } from '../tap-info/definitions';
export type TapConfigPutValueType<DataType> = (tap: Tap, val: DataType, ...args: any[]) => Promise<TapResponse<any>>;
export type TapConfigGetValueType<DataType> = (tap: Tap, ...args: any[]) => Promise<DataType>;
export interface TapConfigItemAction {
    title: string;
    icon?: string;
    color?: string;
    call: (tap: Tap) => Promise<TapResponse<any>>;
    triggersRefresh?: TapInfo[];
}
export interface TapConfigItemBase<DataType = any> extends TapInfoKey {
    icon?: string;
    resolvedValue?: TapInfoHolder;
    viewFormatter?: (input: DataType) => string;
    getValue?: TapConfigGetValueType<DataType> | false;
    setValue?: TapConfigPutValueType<DataType>;
    putValue?: TapConfigPutValueType<DataType>;
    editFormatter?: {
        /**
         * Transform value when it's read from Tap
         */
        read: (input: string) => DataType;
        /**
         * Transform value when it's written to the Tap
         */
        write: (input: DataType | undefined) => string | number;
    };
    input?: {
        formValidators?: ValidatorFn[];
        pattern?: RegExp;
        type?: 'text' | 'number' | 'password' | 'select' | 'toggle' | 'radio';
        options?: {
            key: any;
            text: string;
            icon?: string;
        }[];
        enum?: EnumInfo;
        multiple?: boolean;
        max?: number;
        min?: number;
        maxLength?: number;
        minLength?: number;
    };
}
