import { Component, EventEmitter, Input, Output } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { CoreModule, gettext } from '@c8y/ngx-components';
import { HAS_ERROR } from '../../../datapoints-export-selector.model';
import * as i0 from "@angular/core";
import * as i1 from "@c8y/ngx-components";
import * as i2 from "@angular/common";
import * as i3 from "@angular/forms";
export class DataPointsExportSelectorTimeRangeComponent {
    constructor() {
        this.onDateFromChange = new EventEmitter();
        this.onDateToChange = new EventEmitter();
        this.DATE_FROM = 'dateFrom';
        this.DATE_TO = 'dateTo';
        this.FROM_DATE = gettext('From`date`');
        this.HAS_ERROR = HAS_ERROR;
        this.INVALID_DATE_TIME = 'invalidDateTime';
        this.THIS_DATE_IS_INVALID = gettext('This date is invalid.');
        this.THIS_DATE_IS_AFTER_THE_LAST_ALLOWED_DATE = gettext('This date is after the latest allowed date.');
        this.THIS_DATE_IS_BEFORE_THE_EARLIEST_ALLOWED_DATE = gettext('This date is before the earliest allowed date.');
        this.TO_DATE = gettext('To`date`');
    }
    emitDateFromChange(updatedDate) {
        this.onDateFromChange.emit(updatedDate);
    }
    emitDateToChange(updatedDate) {
        this.onDateToChange.emit(updatedDate);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: DataPointsExportSelectorTimeRangeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.9", type: DataPointsExportSelectorTimeRangeComponent, isStandalone: true, selector: "c8y-datapoints-export-selector-time-range", inputs: { formGroup: "formGroup" }, outputs: { onDateFromChange: "onDateFromChange", onDateToChange: "onDateToChange" }, ngImport: i0, template: "<fieldset class=\"c8y-fieldset\">\n  <legend>{{ 'Time range' | translate }}</legend>\n  <c8y-form-group\n    class=\"m-b-8\"\n    [ngClass]=\"formGroup.controls.dateFrom.errors ? HAS_ERROR : ''\"\n  >\n    <label\n      [title]=\"FROM_DATE | translate\"\n      [for]=\"DATE_FROM\"\n    >\n      {{ FROM_DATE | translate }}\n    </label>\n    <div>\n      <c8y-date-time-picker\n        id=\"DATE_FROM\"\n        [maxDate]=\"formGroup.value.dateTo\"\n        [placeholder]=\"FROM_DATE | translate\"\n        [formControl]=\"formGroup.controls.dateFrom\"\n        [ngClass]=\"formGroup.controls.dateFrom.errors ? HAS_ERROR : ''\"\n        (ngModelChange)=\"emitDateFromChange($event)\"\n      ></c8y-date-time-picker>\n      <c8y-messages [show]=\"formGroup.controls.dateFrom.errors\">\n        <c8y-message\n          name=\"dateAfterRangeMax\"\n          [text]=\"THIS_DATE_IS_AFTER_THE_LAST_ALLOWED_DATE | translate\"\n        ></c8y-message>\n        <c8y-message\n          name=\"INVALID_DATE_TIME\"\n          [text]=\"THIS_DATE_IS_INVALID | translate\"\n        ></c8y-message>\n      </c8y-messages>\n    </div>\n  </c8y-form-group>\n  <c8y-form-group\n    class=\"m-b-8\"\n    [ngClass]=\"formGroup.controls.dateTo.errors ? HAS_ERROR : ''\"\n  >\n    <label\n      [title]=\"TO_DATE | translate\"\n      [for]=\"DATE_TO\"\n    >\n      {{ TO_DATE | translate }}\n    </label>\n    <div>\n      <c8y-date-time-picker\n        id=\"DATE_TO\"\n        [minDate]=\"formGroup.value.dateFrom\"\n        [placeholder]=\"TO_DATE | translate\"\n        [formControl]=\"formGroup.controls.dateTo\"\n        [ngClass]=\"formGroup.controls.dateTo.errors ? HAS_ERROR : ''\"\n        (ngModelChange)=\"emitDateToChange($event)\"\n      ></c8y-date-time-picker>\n      <c8y-messages [show]=\"formGroup.controls.dateTo.errors\">\n        <c8y-message\n          name=\"dateBeforeRangeMin\"\n          [text]=\"THIS_DATE_IS_BEFORE_THE_EARLIEST_ALLOWED_DATE | translate\"\n        ></c8y-message>\n        <c8y-message\n          name=\"INVALID_DATE_TIME\"\n          [text]=\"THIS_DATE_IS_INVALID | translate\"\n        ></c8y-message>\n      </c8y-messages>\n    </div>\n  </c8y-form-group>\n</fieldset>\n", dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i1.FormGroupComponent, selector: "c8y-form-group", inputs: ["hasError", "hasWarning", "hasSuccess", "novalidation", "status"] }, { kind: "directive", type: i1.MessageDirective, selector: "c8y-message", inputs: ["name", "text"] }, { kind: "component", type: i1.MessagesComponent, selector: "c8y-messages", inputs: ["show", "defaults", "helpMessage"] }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i1.DateTimePickerComponent, selector: "c8y-date-time-picker", inputs: ["minDate", "maxDate", "placeholder", "dateInputFormat", "adaptivePosition", "size", "dateType", "config"], outputs: ["onDateSelected"] }, { kind: "ngmodule", type: FormsModule }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: DataPointsExportSelectorTimeRangeComponent, decorators: [{
            type: Component,
            args: [{ selector: 'c8y-datapoints-export-selector-time-range', standalone: true, imports: [CoreModule, FormsModule], template: "<fieldset class=\"c8y-fieldset\">\n  <legend>{{ 'Time range' | translate }}</legend>\n  <c8y-form-group\n    class=\"m-b-8\"\n    [ngClass]=\"formGroup.controls.dateFrom.errors ? HAS_ERROR : ''\"\n  >\n    <label\n      [title]=\"FROM_DATE | translate\"\n      [for]=\"DATE_FROM\"\n    >\n      {{ FROM_DATE | translate }}\n    </label>\n    <div>\n      <c8y-date-time-picker\n        id=\"DATE_FROM\"\n        [maxDate]=\"formGroup.value.dateTo\"\n        [placeholder]=\"FROM_DATE | translate\"\n        [formControl]=\"formGroup.controls.dateFrom\"\n        [ngClass]=\"formGroup.controls.dateFrom.errors ? HAS_ERROR : ''\"\n        (ngModelChange)=\"emitDateFromChange($event)\"\n      ></c8y-date-time-picker>\n      <c8y-messages [show]=\"formGroup.controls.dateFrom.errors\">\n        <c8y-message\n          name=\"dateAfterRangeMax\"\n          [text]=\"THIS_DATE_IS_AFTER_THE_LAST_ALLOWED_DATE | translate\"\n        ></c8y-message>\n        <c8y-message\n          name=\"INVALID_DATE_TIME\"\n          [text]=\"THIS_DATE_IS_INVALID | translate\"\n        ></c8y-message>\n      </c8y-messages>\n    </div>\n  </c8y-form-group>\n  <c8y-form-group\n    class=\"m-b-8\"\n    [ngClass]=\"formGroup.controls.dateTo.errors ? HAS_ERROR : ''\"\n  >\n    <label\n      [title]=\"TO_DATE | translate\"\n      [for]=\"DATE_TO\"\n    >\n      {{ TO_DATE | translate }}\n    </label>\n    <div>\n      <c8y-date-time-picker\n        id=\"DATE_TO\"\n        [minDate]=\"formGroup.value.dateFrom\"\n        [placeholder]=\"TO_DATE | translate\"\n        [formControl]=\"formGroup.controls.dateTo\"\n        [ngClass]=\"formGroup.controls.dateTo.errors ? HAS_ERROR : ''\"\n        (ngModelChange)=\"emitDateToChange($event)\"\n      ></c8y-date-time-picker>\n      <c8y-messages [show]=\"formGroup.controls.dateTo.errors\">\n        <c8y-message\n          name=\"dateBeforeRangeMin\"\n          [text]=\"THIS_DATE_IS_BEFORE_THE_EARLIEST_ALLOWED_DATE | translate\"\n        ></c8y-message>\n        <c8y-message\n          name=\"INVALID_DATE_TIME\"\n          [text]=\"THIS_DATE_IS_INVALID | translate\"\n        ></c8y-message>\n      </c8y-messages>\n    </div>\n  </c8y-form-group>\n</fieldset>\n" }]
        }], propDecorators: { formGroup: [{
                type: Input
            }], onDateFromChange: [{
                type: Output
            }], onDateToChange: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64, 