import { Component, forwardRef } from '@angular/core';
import { gettext } from '../../i18n';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { DEFAULT_INTERVAL_VALUE, DEFAULT_INTERVAL_VALUES } from './widget-auto-refresh-context.model';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "ngx-bootstrap/tooltip";
import * as i3 from "@angular/forms";
import * as i4 from "@ngx-translate/core";
export class AutoRefreshSelectControlComponent {
    constructor() {
        this.DEFAULT_INTERVAL_VALUES = DEFAULT_INTERVAL_VALUES;
        this.START_INTERVAL_VALUE = DEFAULT_INTERVAL_VALUE;
        this.SECONDS_UNTIL_REFRESH = gettext('{{ seconds }} s`until refresh`');
        // eslint-disable-next-line @typescript-eslint/no-empty-function
        this.onTouched = () => { };
    }
    registerOnChange(fn) {
        this.onChange = fn;
    }
    registerOnTouched(fn) {
        this.onTouched = fn;
    }
    writeValue(autoRefreshSeconds) {
        this.autoRefreshSeconds = autoRefreshSeconds;
    }
    onIntervalChange(autoRefreshSeconds) {
        this.onChange(autoRefreshSeconds);
        this.autoRefreshSeconds = autoRefreshSeconds;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: AutoRefreshSelectControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.9", type: AutoRefreshSelectControlComponent, selector: "c8y-auto-refresh-select-control", providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => AutoRefreshSelectControlComponent),
                multi: true
            }
        ], ngImport: i0, template: "<div class=\"c8y-select-wrapper\">\n  <select\n    class=\"form-control text-12\"\n    [attr.aria-label]=\"'Refresh interval in seconds' | translate\"\n    [tooltip]=\"'Refresh interval in seconds' | translate\"\n    placement=\"bottom\"\n    [adaptivePosition]=\"false\"\n    [delay]=\"500\"\n    [container]=\"'body'\"\n    mode\n    [(ngModel)]=\"autoRefreshSeconds\"\n    (ngModelChange)=\"onIntervalChange($event)\"\n    [ngModelOptions]=\"{ standalone: true }\"\n  >\n    <option\n      *ngFor=\"let refreshInterval of DEFAULT_INTERVAL_VALUES\"\n      [ngValue]=\"refreshInterval\"\n      [attr.selected]=\"refreshInterval === START_INTERVAL_VALUE ? '' : null\"\n    >\n      {{ SECONDS_UNTIL_REFRESH | translate: { seconds: refreshInterval / 1000 } }}\n    </option>\n  </select>\n  <span></span>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "tooltip", "placement", "triggers", "container", "containerClass", "boundariesElement", "isOpen", "isDisabled", "delay", "tooltipHtml", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "tooltipAnimation", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipFadeDuration", "tooltipTrigger"], outputs: ["tooltipChange", "onShown", "onHidden", "tooltipStateChanged"], exportAs: ["bs-tooltip"] }, { kind: "directive", type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: AutoRefreshSelectControlComponent, decorators: [{
            type: Component,
            args: [{ selector: 'c8y-auto-refresh-select-control', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => AutoRefreshSelectControlComponent),
                            multi: true
                        }
                    ], template: "<div class=\"c8y-select-wrapper\">\n  <select\n    class=\"form-control text-12\"\n    [attr.aria-label]=\"'Refresh interval in seconds' | translate\"\n    [tooltip]=\"'Refresh interval in seconds' | translate\"\n    placement=\"bottom\"\n    [adaptivePosition]=\"false\"\n    [delay]=\"500\"\n    [container]=\"'body'\"\n    mode\n    [(ngModel)]=\"autoRefreshSeconds\"\n    (ngModelChange)=\"onIntervalChange($event)\"\n    [ngModelOptions]=\"{ standalone: true }\"\n  >\n    <option\n      *ngFor=\"let refreshInterval of DEFAULT_INTERVAL_VALUES\"\n      [ngValue]=\"refreshInterval\"\n      [attr.selected]=\"refreshInterval === START_INTERVAL_VALUE ? '' : null\"\n    >\n      {{ SECONDS_UNTIL_REFRESH | translate: { seconds: refreshInterval / 1000 } }}\n    </option>\n  </select>\n  <span></span>\n</div>\n" }]
        }] });
//# sourceMappingURL=data:application/json;base64, 