import * as i0 from '@angular/core';
import { Component, Input, NgModule } from '@angular/core';
import * as i1 from '@angular/forms';
import { Validators, ReactiveFormsModule } from '@angular/forms';
import * as i2 from '@c8y/ngx-components';
import { gettext, CoreModule, FormsModule } from '@c8y/ngx-components';
import { get } from 'lodash-es';
import { BulkOperationType } from '@c8y/ngx-components/operations/bulk-operations-service';
import * as i3 from '@c8y/ngx-components/operations/bulk-operation-scheduler';
import { BulkOperationSchedulerModule } from '@c8y/ngx-components/operations/bulk-operation-scheduler';

class CreateBulkOperationDetailsComponent {
    set bulkOperationType(bulkOperationType) {
        this.titlePlaceholder = get(this.placeholders[bulkOperationType], 'title');
        this.descriptionPlaceholder = get(this.placeholders[bulkOperationType], 'description', gettext('e.g. Reset factory settings of all devices of model XYZ'));
    }
    constructor(formBuilder) {
        this.formBuilder = formBuilder;
        this.titlePlaceholder = gettext('e.g. Reset factory settings');
        this.descriptionPlaceholder = gettext('e.g. Reset factory settings of all devices of model XYZ');
        this.placeholders = {
            [BulkOperationType.SOFTWARE]: {
                title: gettext('e.g. Cloud connectivity software'),
                description: gettext('e.g. Cloud connectivity software applied to devices with type c8y_Linux')
            },
            [BulkOperationType.FIRMWARE]: {
                title: gettext('e.g. Firmware for hardware revision B'),
                description: gettext('e.g. Firmware for hardware revision B applied to devices with type c8y_Linux')
            },
            [BulkOperationType.CONFIGURATION]: {
                title: gettext('e.g. Host configuration c8y_Linux'),
                description: gettext('e.g. Host configuration applied to devices with type c8y_Linux')
            },
            [BulkOperationType.DEVICE_PROFILE]: {
                title: gettext('e.g. Device profile for c8y_Linux devices'),
                description: gettext('e.g. Device profile applied to devices with type c8y_Linux')
            }
        };
    }
    ngOnInit() {
        const config = {
            description: ['', Validators.required],
            note: [''],
            schedule: []
        };
        this.fgOperationDescription = this.formBuilder.group(config);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: CreateBulkOperationDetailsComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.9", type: CreateBulkOperationDetailsComponent, selector: "c8y-create-bulk-operation-details", inputs: { bulkOperationType: "bulkOperationType" }, ngImport: i0, template: "<div [formGroup]=\"fgOperationDescription\">\n  <c8y-form-group>\n    <label translate>Title</label>\n    <input\n      class=\"form-control\"\n      required\n      formControlName=\"description\"\n      [placeholder]=\"titlePlaceholder | translate\"\n    />\n  </c8y-form-group>\n  <c8y-form-group>\n    <label translate>Description</label>\n    <textarea\n      class=\"form-control\"\n      rows=\"3\"\n      formControlName=\"note\"\n      [placeholder]=\"descriptionPlaceholder | translate\"\n    ></textarea>\n  </c8y-form-group>\n  <c8y-operation-scheduler formControlName=\"schedule\"></c8y-operation-scheduler>\n</div>\n", dependencies: [{ kind: "directive", type: i2.C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "component", type: i2.FormGroupComponent, selector: "c8y-form-group", inputs: ["hasError", "hasWarning", "hasSuccess", "novalidation", "status"] }, { kind: "directive", type: i2.RequiredInputPlaceholderDirective, selector: "input[required], input[formControlName]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i3.OperationSchedulerComponent, selector: "c8y-operation-scheduler", inputs: ["minutesAhead"] }, { kind: "pipe", type: i2.C8yTranslatePipe, name: "translate" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: CreateBulkOperationDetailsComponent, decorators: [{
            type: Component,
            args: [{ selector: 'c8y-create-bulk-operation-details', template: "<div [formGroup]=\"fgOperationDescription\">\n  <c8y-form-group>\n    <label translate>Title</label>\n    <input\n      class=\"form-control\"\n      required\n      formControlName=\"description\"\n      [placeholder]=\"titlePlaceholder | translate\"\n    />\n  </c8y-form-group>\n  <c8y-form-group>\n    <label translate>Description</label>\n    <textarea\n      class=\"form-control\"\n      rows=\"3\"\n      formControlName=\"note\"\n      [placeholder]=\"descriptionPlaceholder | translate\"\n    ></textarea>\n  </c8y-form-group>\n  <c8y-operation-scheduler formControlName=\"schedule\"></c8y-operation-scheduler>\n</div>\n" }]
        }], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { bulkOperationType: [{
                type: Input
            }] } });

/**
 * This module provides a component for entering operation details.
 */
class CreateBulkOperationDetailsModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: CreateBulkOperationDetailsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.9", ngImport: i0, type: CreateBulkOperationDetailsModule, declarations: [CreateBulkOperationDetailsComponent], imports: [CoreModule, FormsModule, ReactiveFormsModule, BulkOperationSchedulerModule], exports: [CreateBulkOperationDetailsComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: CreateBulkOperationDetailsModule, imports: [CoreModule, FormsModule, ReactiveFormsModule, BulkOperationSchedulerModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: CreateBulkOperationDetailsModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [CoreModule, FormsModule, ReactiveFormsModule, BulkOperationSchedulerModule],
                    declarations: [CreateBulkOperationDetailsComponent],
                    exports: [CreateBulkOperationDetailsComponent]
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { CreateBulkOperationDetailsComponent, CreateBulkOperationDetailsModule };
//# sourceMappingURL=c8y-ngx-components-operations-create-bulk-operation-details.mjs.map
