import { Component, forwardRef, Input } from '@angular/core';
import { operationStatusClasses, operationStatusIcons, PRODUCT_EXPERIENCE_EVENT_SOURCE } from '@c8y/ngx-components';
import { ACTIONS_OPERATIONS, COMPONENTS } from '@c8y/ngx-components/operations/product-experience';
import { OperationDetailsService } from './operation-details.service';
import * as i0 from "@angular/core";
import * as i1 from "./operation-details.service";
import * as i2 from "@c8y/ngx-components";
import * as i3 from "@angular/common";
import * as i4 from "ngx-bootstrap/tooltip";
/**
 * Operation details component displays a single operation's status, description and creationTime.
 *
 * ```html
 * <c8y-operation-details [operation]="operation"></c8y-operation-details>
 * ```
 */
export class OperationDetailsComponent {
    constructor(operationDetailsService) {
        this.operationDetailsService = operationDetailsService;
        this.ACTIONS = ACTIONS_OPERATIONS;
        this.productExperienceEvent = {
            eventName: undefined, // supress emitting events if a parent component does not declare event name
            data: {
                component: COMPONENTS.OPERATION_DETAILS
            }
        };
    }
    ngOnInit() {
        this.statusIcons = operationStatusIcons;
        this.statusClasses = operationStatusClasses;
    }
    openDetails() {
        this.operationDetailsService.openDetails(this.operation);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OperationDetailsComponent, deps: [{ token: i1.OperationDetailsService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: OperationDetailsComponent, selector: "c8y-operation-details", inputs: { operation: "operation" }, providers: [
            {
                provide: PRODUCT_EXPERIENCE_EVENT_SOURCE,
                useExisting: forwardRef(() => OperationDetailsComponent)
            }
        ], ngImport: i0, template: "<div class=\"c8y-list--group\" *ngIf=\"operation\">\n  <a class=\"c8y-list__item\">\n    <div class=\"c8y-list__item__block\">\n      <div class=\"c8y-list__item__icon\">\n        <button\n          class=\"btn-clean\"\n          type=\"button\"\n          [attr.aria-label]=\"operation.status?.toString() | translate\"\n          [tooltip]=\"operation.status?.toString() | translate\"\n          [delay]=\"500\"\n          placement=\"right\"\n          container=\"body\"\n        >\n          <i\n            [c8yIcon]=\"statusIcons[operation.status]\"\n            [ngClass]=\"statusClasses[operation.status]\"\n          ></i>\n        </button>\n      </div>\n      <div class=\"c8y-list__item__body p-r-16\">\n        <div class=\"content-flex-40\">\n          <div class=\"col-8\">\n            <button\n              class=\"btn-clean text-truncate\"\n              type=\"button\"\n              title=\"{{ operation.description | translate }}\"\n              (click)=\"openDetails()\"\n              c8yProductExperience\n              inherit\n              [actionData]=\"{ action: ACTIONS.OPEN_OPERATION_DETAILS }\"\n            >\n              {{ operation.description | translate }}\n            </button>\n          </div>\n          <div class=\"col-4 text-muted\">\n            <small class=\"icon-flex\">\n              <i c8yIcon=\"calendar\" class=\"m-r-4\"></i>\n              <span>{{ operation.creationTime | c8yDate }}</span>\n            </small>\n          </div>\n        </div>\n      </div>\n    </div>\n  </a>\n</div>\n", dependencies: [{ kind: "directive", type: i2.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ProductExperienceDirective, selector: "[c8yProductExperience]", inputs: ["actionName", "actionData", "inherit", "suppressDataOverriding"] }, { kind: "directive", type: i4.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: "pipe", type: i2.C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: i2.DatePipe, name: "c8yDate" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OperationDetailsComponent, decorators: [{
            type: Component,
            args: [{ selector: 'c8y-operation-details', providers: [
                        {
                            provide: PRODUCT_EXPERIENCE_EVENT_SOURCE,
                            useExisting: forwardRef(() => OperationDetailsComponent)
                        }
                    ], template: "<div class=\"c8y-list--group\" *ngIf=\"operation\">\n  <a class=\"c8y-list__item\">\n    <div class=\"c8y-list__item__block\">\n      <div class=\"c8y-list__item__icon\">\n        <button\n          class=\"btn-clean\"\n          type=\"button\"\n          [attr.aria-label]=\"operation.status?.toString() | translate\"\n          [tooltip]=\"operation.status?.toString() | translate\"\n          [delay]=\"500\"\n          placement=\"right\"\n          container=\"body\"\n        >\n          <i\n            [c8yIcon]=\"statusIcons[operation.status]\"\n            [ngClass]=\"statusClasses[operation.status]\"\n          ></i>\n        </button>\n      </div>\n      <div class=\"c8y-list__item__body p-r-16\">\n        <div class=\"content-flex-40\">\n          <div class=\"col-8\">\n            <button\n              class=\"btn-clean text-truncate\"\n              type=\"button\"\n              title=\"{{ operation.description | translate }}\"\n              (click)=\"openDetails()\"\n              c8yProductExperience\n              inherit\n              [actionData]=\"{ action: ACTIONS.OPEN_OPERATION_DETAILS }\"\n            >\n              {{ operation.description | translate }}\n            </button>\n          </div>\n          <div class=\"col-4 text-muted\">\n            <small class=\"icon-flex\">\n              <i c8yIcon=\"calendar\" class=\"m-r-4\"></i>\n              <span>{{ operation.creationTime | c8yDate }}</span>\n            </small>\n          </div>\n        </div>\n      </div>\n    </div>\n  </a>\n</div>\n" }]
        }], ctorParameters: () => [{ type: i1.OperationDetailsService }], propDecorators: { operation: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 