import { Component, Input } from '@angular/core';
import { InventoryService } from '@c8y/client';
import * as i0 from "@angular/core";
import * as i1 from "@c8y/client";
import * as i2 from "@c8y/ngx-components";
import * as i3 from "@angular/common";
export class OperationSummaryComponent {
    set deviceQueryString(query) {
        this.displayDeviceCount = true;
        const filters = {
            q: query || '',
            pageSize: 1,
            currentPage: 1,
            withTotalPages: true
        };
        this.inventoryService
            .list(filters)
            .then((result) => (this.deviceCount = result.paging.totalPages));
    }
    constructor(inventoryService) {
        this.inventoryService = inventoryService;
        this.deviceCount = 0;
        this.displayDeviceCount = false;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: OperationSummaryComponent, deps: [{ token: i1.InventoryService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.9", type: OperationSummaryComponent, selector: "c8y-operation-summary", inputs: { name: "name", description: "description", deviceQueryString: "deviceQueryString" }, ngImport: i0, template: "<div class=\"d-flex\">\n  <div class=\"p-l-0 col-xs-12 col-sm-6\">\n    <h4>{{ name | translate }}</h4>\n    <p class=\"text-muted m-b-8\">\n      {{ description | translate }}\n    </p>\n  </div>\n  <div class=\"p-r-0 text-right col-xs-12 col-sm-6\">\n    <span\n      [ngPlural]=\"deviceCount\"\n      *ngIf=\"displayDeviceCount && deviceCount !== undefined && deviceCount !== null\"\n    >\n      <ng-template ngPluralCase=\"=0\">\n        <span\n          class=\"label label-default\"\n          translate\n        >\n          No devices selected\n        </span>\n      </ng-template>\n      <ng-template ngPluralCase=\"=1\">\n        <span class=\"badge badge-info m-r-4\">1</span>\n        <span translate>device selected</span>\n      </ng-template>\n      <ng-template ngPluralCase=\"other\">\n        <span class=\"badge badge-info m-r-4\">{{ deviceCount }}</span>\n        <span translate>devices selected</span>\n      </ng-template>\n    </span>\n  </div>\n</div>\n", dependencies: [{ kind: "directive", type: i2.C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgPlural, selector: "[ngPlural]", inputs: ["ngPlural"] }, { kind: "directive", type: i3.NgPluralCase, selector: "[ngPluralCase]" }, { kind: "pipe", type: i2.C8yTranslatePipe, name: "translate" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: OperationSummaryComponent, decorators: [{
            type: Component,
            args: [{ selector: 'c8y-operation-summary', template: "<div class=\"d-flex\">\n  <div class=\"p-l-0 col-xs-12 col-sm-6\">\n    <h4>{{ name | translate }}</h4>\n    <p class=\"text-muted m-b-8\">\n      {{ description | translate }}\n    </p>\n  </div>\n  <div class=\"p-r-0 text-right col-xs-12 col-sm-6\">\n    <span\n      [ngPlural]=\"deviceCount\"\n      *ngIf=\"displayDeviceCount && deviceCount !== undefined && deviceCount !== null\"\n    >\n      <ng-template ngPluralCase=\"=0\">\n        <span\n          class=\"label label-default\"\n          translate\n        >\n          No devices selected\n        </span>\n      </ng-template>\n      <ng-template ngPluralCase=\"=1\">\n        <span class=\"badge badge-info m-r-4\">1</span>\n        <span translate>device selected</span>\n      </ng-template>\n      <ng-template ngPluralCase=\"other\">\n        <span class=\"badge badge-info m-r-4\">{{ deviceCount }}</span>\n        <span translate>devices selected</span>\n      </ng-template>\n    </span>\n  </div>\n</div>\n" }]
        }], ctorParameters: () => [{ type: i1.InventoryService }], propDecorators: { name: [{
                type: Input
            }], description: [{
                type: Input
            }], deviceQueryString: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3BlcmF0aW9uLXN1bW1hcnkuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vb3BlcmF0aW9ucy9vcGVyYXRpb24tc3VtbWFyeS9vcGVyYXRpb24tc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