import * as _angular_core from '@angular/core';
import { LookupMatrixFieldConfig, LookupOptionItemConfig, LookupMatrixCellConfig, SchedulePredecessorFieldRuntimeContext } from '@masterteam/components';
import { ControlValueAccessor, Validators, NgControl } from '@angular/forms';
import { HttpContext } from '@angular/common/http';
import { ColumnDef, TableAction } from '@masterteam/components/table';

declare class LookupMatrixField {
    readonly config: _angular_core.InputSignal<LookupMatrixFieldConfig>;
    private readonly controlContainer;
    private readonly destroyRef;
    private readonly valueVersion;
    readonly xOptions: _angular_core.Signal<LookupOptionItemConfig[]>;
    readonly yOptions: _angular_core.Signal<LookupOptionItemConfig[]>;
    readonly hasMatrix: _angular_core.Signal<boolean>;
    readonly cellMap: _angular_core.Signal<Map<string, LookupMatrixCellConfig>>;
    readonly selectedXOption: _angular_core.Signal<LookupOptionItemConfig | null>;
    readonly selectedYOption: _angular_core.Signal<LookupOptionItemConfig | null>;
    readonly activeCell: _angular_core.Signal<LookupMatrixCellConfig | null>;
    readonly selectionSummary: _angular_core.Signal<string>;
    readonly pendingMessage: _angular_core.Signal<string>;
    readonly missingResultMessage: _angular_core.Signal<string>;
    constructor();
    getCell(xLookupItemId: number | string, yLookupItemId: number | string): LookupMatrixCellConfig | null;
    getSwatchStyle(color?: string | null): Record<string, string>;
    private getControlValue;
    private resolveSelectedOption;
    private optionMatchesValue;
    private cellKey;
    private resolveColor;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<LookupMatrixField, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<LookupMatrixField, "mt-lookup-matrix-field", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
}

/**
 * One source level inside connection configuration.
 * Comes from `field.propertyMetadata.configuration.sourceLevels[]`
 */
interface ConnectionSourceLevel {
    levelId: number;
    levelKey: string;
    name: {
        en?: string;
        ar?: string;
        [k: string]: string | undefined;
    };
    connectionId: number;
    isOptional: boolean;
    allowManyToMany: boolean;
    supportWeights: boolean;
    optionsQuery: {
        path: string;
        method?: string;
        query?: Record<string, unknown>;
    };
}
/**
 * Full connection configuration from `field.propertyMetadata.configuration`.
 * This is passed as a single input to the component.
 */
interface SchemaConnectionConfig {
    targetLevelId: number;
    sourceLevelId?: number;
    propertyKey?: string;
    valueMode?: string;
    sourceLevels: ConnectionSourceLevel[];
    payloadTemplate?: {
        levelId: number;
        sources: any[];
    };
    sourceItemShape?: Record<string, string>;
}
/** One selected source in the connection payload */
interface ConnectionSource {
    sourceLevelId: number;
    sourceLevelDataId: number;
}
/** The value shape for a connection field */
interface ConnectionPayload {
    levelId: number;
    sources: ConnectionSource[];
}
/**
 * Internal state tracked per source level dropdown.
 */
interface SourceLevelState {
    source: ConnectionSourceLevel;
    options: any[];
    loading: boolean;
}
declare class SchemaConnectionField implements ControlValueAccessor {
    readonly label: _angular_core.InputSignal<string>;
    readonly placeholder: _angular_core.InputSignal<string>;
    readonly readonly: _angular_core.InputSignal<boolean>;
    readonly required: _angular_core.InputSignal<boolean>;
    readonly filter: _angular_core.InputSignal<boolean>;
    /**
     * Full connection configuration object from the API.
     * Includes `targetLevelId`, `sourceLevels[]`, `payloadTemplate`, etc.
     */
    readonly configuration: _angular_core.InputSignal<SchemaConnectionConfig>;
    /**
     * Optional HttpContext for API requests (e.g. to set base URL behavior).
     */
    readonly context: _angular_core.InputSignal<HttpContext | undefined>;
    /** The full ConnectionPayload value */
    value: _angular_core.WritableSignal<ConnectionPayload | null>;
    disabled: _angular_core.WritableSignal<boolean>;
    /** Per-source-level state: options + loading */
    sourceLevelStates: _angular_core.WritableSignal<SourceLevelState[]>;
    /** Mutable selections per source level: sourceLevelId -> selected value */
    selections: Record<number, any>;
    requiredValidator: typeof Validators.required;
    onTouched: () => void;
    onModelChange: (value: ConnectionPayload | null) => void;
    ngControl: NgControl | null;
    private http;
    private destroyRef;
    /**
     * Source levels from configuration.
     */
    readonly sourceLevels: _angular_core.Signal<ConnectionSourceLevel[]>;
    /**
     * Percentage width for each dropdown, evenly divided.
     */
    readonly dropdownWidth: _angular_core.Signal<string>;
    constructor();
    private loadOptions;
    private updateSourceState;
    /**
     * Single handler — no params. Reads all selections, builds the combined payload.
     */
    syncValue(): void;
    private distributeToSelections;
    writeValue(value: ConnectionPayload | string | null): void;
    registerOnChange(fn: (value: ConnectionPayload | null) => void): void;
    registerOnTouched(fn: any): void;
    setDisabledState(disabled: boolean): void;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<SchemaConnectionField, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<SchemaConnectionField, "mt-schema-connection-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "filter": { "alias": "filter"; "required": false; "isSignal": true; }; "configuration": { "alias": "configuration"; "required": true; "isSignal": true; }; "context": { "alias": "context"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
}

type PredecessorType = 0 | 1 | 2 | 3;
interface SchedulePredecessorValue {
    predecessorId: number | string;
    type: PredecessorType;
    lagDays: number;
}
interface SchedulePredecessorRow extends SchedulePredecessorValue {
    key: string;
}
interface SelectOption {
    label: string;
    value: number | string;
}
declare class SchedulePredecessorField implements ControlValueAccessor {
    private readonly predecessorCellTpl;
    private readonly typeCellTpl;
    private readonly lagCellTpl;
    readonly label: _angular_core.InputSignal<string>;
    readonly placeholder: _angular_core.InputSignal<string>;
    readonly readonly: _angular_core.InputSignal<boolean>;
    readonly required: _angular_core.InputSignal<boolean>;
    readonly configuration: _angular_core.InputSignal<unknown>;
    readonly runtimeContext: _angular_core.InputSignal<SchedulePredecessorFieldRuntimeContext | null>;
    readonly loading: _angular_core.WritableSignal<boolean>;
    readonly taskOptions: _angular_core.WritableSignal<SelectOption[]>;
    readonly rows: _angular_core.WritableSignal<SchedulePredecessorRow[]>;
    readonly disabled: _angular_core.WritableSignal<boolean>;
    readonly typeOptions: _angular_core.Signal<SelectOption[]>;
    readonly availableTaskOptions: _angular_core.Signal<SelectOption[]>;
    readonly canAddRow: _angular_core.Signal<boolean>;
    readonly addTooltip: _angular_core.Signal<string | undefined>;
    readonly pageSize: _angular_core.Signal<number>;
    readonly columns: _angular_core.WritableSignal<ColumnDef[]>;
    readonly rowActions: _angular_core.Signal<TableAction[]>;
    requiredValidator: typeof Validators.required;
    onTouched: () => void;
    onModelChange: (value: string | null) => void;
    ngControl: NgControl | null;
    private readonly http;
    private readonly transloco;
    private readonly destroyRef;
    private readonly activeLang;
    private rowKey;
    readonly texts: _angular_core.Signal<{
        noAvailable: string;
        predecessor: string;
        type: string;
        lagDays: string;
        delete: string;
    }>;
    constructor();
    addRow(): void;
    removeRow(key: string): void;
    updateRow(key: string, patch: Partial<SchedulePredecessorRow>): void;
    writeValue(value: unknown): void;
    registerOnChange(fn: (value: string | null) => void): void;
    registerOnTouched(fn: () => void): void;
    setDisabledState(disabled: boolean): void;
    private syncRows;
    private loadTaskOptions;
    private mapTaskOptions;
    private resolveRootRecords;
    private flattenRecords;
    private nextRowKey;
    private parseCompactValue;
    private formatCompactValue;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<SchedulePredecessorField, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<SchedulePredecessorField, "mt-schedule-predecessor-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "configuration": { "alias": "configuration"; "required": false; "isSignal": true; }; "runtimeContext": { "alias": "runtimeContext"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
}

export { LookupMatrixField, SchedulePredecessorField, SchemaConnectionField };
export type { ConnectionPayload, ConnectionSource, ConnectionSourceLevel, SchemaConnectionConfig, SourceLevelState };
