import { HomeAssistant } from './../home-assistant';
import type { Connection } from 'home-assistant-js-websocket';
export interface Lovelace {
    config: LovelaceConfig;
    rawConfig: LovelaceRawConfig;
    editMode: boolean;
    urlPath: string | null;
    mode: 'generated' | 'yaml' | 'storage';
    locale: any;
    enableFullEditMode: () => void;
    setEditMode: (editMode: boolean) => void;
    saveConfig: (newConfig: LovelaceRawConfig) => Promise<void>;
    deleteConfig: () => Promise<void>;
    showToast: (params: any) => void;
}
export declare function getLovelace(): Lovelace | null;
export declare function findCardIndex(card: any): Promise<string | null>;
export type LovelaceCardPath = [number, number] | [number, number, number];
export type LovelaceContainerPath = [number] | [number, number];
export declare const parseLovelaceCardPath: (path: LovelaceCardPath) => {
    viewIndex: number;
    sectionIndex?: number;
    cardIndex: number;
};
export declare const parseLovelaceContainerPath: (path: LovelaceContainerPath) => {
    viewIndex: number;
    sectionIndex?: number;
};
export declare const getLovelaceContainerPath: (path: LovelaceCardPath) => LovelaceContainerPath;
type FindLovelaceContainer = {
    (config: LovelaceConfig, path: [number]): LovelaceViewRawConfig;
    (config: LovelaceConfig, path: [number, number]): LovelaceSectionRawConfig;
    (config: LovelaceConfig, path: LovelaceContainerPath): LovelaceViewRawConfig | LovelaceSectionRawConfig;
};
export declare const findLovelaceContainer: FindLovelaceContainer;
export declare const findLovelaceCards: (config: LovelaceConfig, path: LovelaceContainerPath) => LovelaceCardConfig[] | undefined;
export declare const updateLovelaceContainer: (config: LovelaceConfig, path: LovelaceContainerPath, containerConfig: LovelaceViewRawConfig | LovelaceSectionRawConfig) => LovelaceConfig;
export declare const updateLovelaceCards: (config: LovelaceConfig, path: LovelaceContainerPath, cards: LovelaceCardConfig[]) => LovelaceConfig;
export interface LovelaceCardEditor extends LovelaceGenericElementEditor {
    setConfig(config: LovelaceCardConfig): void;
}
export interface LovelaceGenericElementEditor<C = any> extends HTMLElement {
    hass?: HomeAssistant;
    lovelace?: LovelaceConfig;
    context?: C;
    setConfig(config: any): void;
    focusYamlEditor?: () => void;
}
export interface LovelaceDashboardBaseConfig {
}
export interface LovelaceCard extends HTMLElement {
    hass?: HomeAssistant;
    isPanel?: boolean;
    preview?: boolean;
    layout?: string;
    getCardSize(): number | Promise<number>;
    getLayoutOptions?(): LovelaceLayoutOptions;
    setConfig(config: LovelaceCardConfig): void;
}
export interface LovelaceConfig extends LovelaceDashboardBaseConfig {
    background?: string;
    views: LovelaceViewRawConfig[];
}
export interface LovelaceDashboardStrategyConfig extends LovelaceDashboardBaseConfig {
    strategy: LovelaceStrategyConfig;
}
export interface LegacyLovelaceConfig extends LovelaceConfig {
    resources?: LovelaceResource[];
}
export type LovelaceRawConfig = LovelaceConfig | LovelaceDashboardStrategyConfig;
export declare function isStrategyDashboard(config: LovelaceRawConfig): config is LovelaceDashboardStrategyConfig;
export declare const fetchConfig: (conn: Connection, urlPath: string | null, force: boolean) => Promise<LovelaceRawConfig>;
export declare const saveConfig: (hass: HomeAssistant, urlPath: string | null, config: LovelaceRawConfig) => Promise<void>;
export declare const deleteConfig: (hass: HomeAssistant, urlPath: string | null) => Promise<void>;
export interface ShowViewConfig {
    user?: string;
}
interface LovelaceViewBackgroundConfig {
    image?: string;
}
export interface LovelaceBaseViewConfig {
    index?: number;
    title?: string;
    path?: string;
    icon?: string;
    theme?: string;
    panel?: boolean;
    background?: string | LovelaceViewBackgroundConfig;
    visible?: boolean | ShowViewConfig[];
    subview?: boolean;
    back_path?: string;
    max_columns?: number;
}
export interface LovelaceViewConfig extends LovelaceBaseViewConfig {
    type?: string;
    badges?: Array<string | LovelaceBadgeConfig>;
    cards?: LovelaceCardConfig[];
    sections?: LovelaceSectionRawConfig[];
}
export interface LovelaceStrategyViewConfig extends LovelaceBaseViewConfig {
    strategy: LovelaceStrategyConfig;
}
export type LovelaceViewRawConfig = LovelaceViewConfig | LovelaceStrategyViewConfig;
export declare function isStrategyView(view: LovelaceViewRawConfig): view is LovelaceStrategyViewConfig;
export interface LovelaceBaseSectionConfig {
    visibility?: Condition[];
    column_span?: number;
    row_span?: number;
    /**
     * @deprecated Use heading card instead.
     */
    title?: string;
}
export interface LovelaceSectionConfig extends LovelaceBaseSectionConfig {
    type?: string;
    cards?: LovelaceCardConfig[];
}
export interface LovelaceStrategySectionConfig extends LovelaceBaseSectionConfig {
    strategy: LovelaceStrategyConfig;
}
export type LovelaceSectionRawConfig = LovelaceSectionConfig | LovelaceStrategySectionConfig;
export declare function isStrategySection(section: LovelaceSectionRawConfig): section is LovelaceStrategySectionConfig;
export interface LovelaceStrategyConfig {
    type: string;
    [key: string]: any;
}
export interface LovelaceBadgeConfig {
    type: string;
    [key: string]: any;
    visibility?: Condition[];
}
export declare const ensureBadgeConfig: (config: Partial<LovelaceBadgeConfig> | string) => LovelaceBadgeConfig;
export interface LovelaceCardConfig {
    index?: number;
    view_index?: number;
    view_layout?: any;
    layout_options?: LovelaceLayoutOptions;
    type: string;
    [key: string]: any;
    visibility?: Condition[];
}
export type LovelaceLayoutOptions = {
    grid_columns?: number | 'full';
    grid_rows?: number | 'auto';
    grid_max_columns?: number;
    grid_min_columns?: number;
    grid_min_rows?: number;
    grid_max_rows?: number;
};
export interface LovelaceGridOptions {
    columns?: number | 'full';
    rows?: number | 'auto';
    max_columns?: number;
    min_columns?: number;
    min_rows?: number;
    max_rows?: number;
}
export type Condition = NumericStateCondition | StateCondition | ScreenCondition | UserCondition | OrCondition | AndCondition;
export interface LegacyCondition {
    entity?: string;
    state?: string | string[];
    state_not?: string | string[];
}
interface BaseCondition {
    condition: string;
}
export interface NumericStateCondition extends BaseCondition {
    condition: 'numeric_state';
    entity?: string;
    below?: string | number;
    above?: string | number;
}
export interface StateCondition extends BaseCondition {
    condition: 'state';
    entity?: string;
    state?: string | string[];
    state_not?: string | string[];
}
export interface ScreenCondition extends BaseCondition {
    condition: 'screen';
    media_query?: string;
}
export interface UserCondition extends BaseCondition {
    condition: 'user';
    users?: string[];
}
export interface OrCondition extends BaseCondition {
    condition: 'or';
    conditions?: Condition[];
}
export interface AndCondition extends BaseCondition {
    condition: 'and';
    conditions?: Condition[];
}
export type LovelaceResource = {
    id: string;
    type: 'css' | 'js' | 'module' | 'html';
    url: string;
};
export type LovelaceResourcesMutableParams = {
    res_type: LovelaceResource['type'];
    url: string;
};
export declare const fetchResources: (conn: Connection) => Promise<LovelaceResource[]>;
export declare const createResource: (hass: HomeAssistant, values: LovelaceResourcesMutableParams) => Promise<LovelaceResource>;
export declare const updateResource: (hass: HomeAssistant, id: string, updates: Partial<LovelaceResourcesMutableParams>) => Promise<LovelaceResource>;
export declare const deleteResource: (hass: HomeAssistant, id: string) => Promise<unknown>;
export {};
