import { NgFor } from '@angular/common';
import * as i0 from '@angular/core';
import { Component, makeEnvironmentProviders } from '@angular/core';
import * as i3 from '@angular/router';
import * as i2 from '@c8y/ngx-components';
import { IconDirective, ActionBarItemComponent, HelpModule, C8yTranslatePipe, hookRoute, ViewContext } from '@c8y/ngx-components';
import { OperationsListComponent } from '@c8y/ngx-components/operations/operations-list';
import * as i1 from '@c8y/ngx-components/services/shared';
import { gettext } from '@c8y/ngx-components/gettext';

class ServiceCommandTabComponent {
    constructor(commandService, contextRouteService, activatedRoute) {
        this.actions = [];
        const { contextData } = contextRouteService.getContextData(activatedRoute);
        this.service = contextData;
        const commands = commandService.getAllSupportedCommands([contextData]);
        this.actions = commandService.generateActionControls(commands);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ServiceCommandTabComponent, deps: [{ token: i1.ServiceCommandService }, { token: i2.ContextRouteService }, { token: i3.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.25", type: ServiceCommandTabComponent, isStandalone: true, selector: "c8y-service-command-tab", ngImport: i0, template: "<c8y-action-bar-item\n  *ngFor=\"let action of actions; let i = index\"\n  [placement]=\"i < 3 ? 'right' : 'more'\"\n>\n  <button\n    class=\"d-flex a-i-center {{ i < 3 ? 'btn btn-link' : '' }}\"\n    style=\"max-width: {{ i < 3 ? '160px' : 'unset' }};\"\n    [title]=\"action.text | translate\"\n    (click)=\"action.callback(service)\"\n  >\n    <i\n      class=\"m-r-4\"\n      [class]=\"action.iconClasses\"\n      [c8yIcon]=\"action.icon\"\n    ></i>\n    <span class=\"text-truncate\">\n      {{ action.text | translate }}\n    </span>\n  </button>\n</c8y-action-bar-item>\n\n<c8y-operations-list\n  fragmentType=\"c8y_ServiceCommand\"\n  [readOnlyItems]=\"true\"\n>\n  <!-- TODO Add context help\n  <c8y-help></c8y-help>\n  -->\n</c8y-operations-list>\n", dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "component", type: OperationsListComponent, selector: "c8y-operations-list", inputs: ["fragmentType", "readOnlyItems"] }, { kind: "component", type: ActionBarItemComponent, selector: "c8y-action-bar-item", inputs: ["placement", "priority", "itemClass", "injector", "groupId", "inGroupPriority"] }, { kind: "ngmodule", type: HelpModule }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ServiceCommandTabComponent, decorators: [{
            type: Component,
            args: [{ selector: 'c8y-service-command-tab', standalone: true, imports: [
                        NgFor,
                        IconDirective,
                        OperationsListComponent,
                        ActionBarItemComponent,
                        HelpModule,
                        C8yTranslatePipe
                    ], template: "<c8y-action-bar-item\n  *ngFor=\"let action of actions; let i = index\"\n  [placement]=\"i < 3 ? 'right' : 'more'\"\n>\n  <button\n    class=\"d-flex a-i-center {{ i < 3 ? 'btn btn-link' : '' }}\"\n    style=\"max-width: {{ i < 3 ? '160px' : 'unset' }};\"\n    [title]=\"action.text | translate\"\n    (click)=\"action.callback(service)\"\n  >\n    <i\n      class=\"m-r-4\"\n      [class]=\"action.iconClasses\"\n      [c8yIcon]=\"action.icon\"\n    ></i>\n    <span class=\"text-truncate\">\n      {{ action.text | translate }}\n    </span>\n  </button>\n</c8y-action-bar-item>\n\n<c8y-operations-list\n  fragmentType=\"c8y_ServiceCommand\"\n  [readOnlyItems]=\"true\"\n>\n  <!-- TODO Add context help\n  <c8y-help></c8y-help>\n  -->\n</c8y-operations-list>\n" }]
        }], ctorParameters: () => [{ type: i1.ServiceCommandService }, { type: i2.ContextRouteService }, { type: i3.ActivatedRoute }] });

const serviceCommandTabFeatureProvider = makeEnvironmentProviders([
    hookRoute({
        context: ViewContext.Service,
        path: 'commands',
        component: ServiceCommandTabComponent,
        label: gettext('Commands'),
        icon: 'sliders1',
        priority: 600
    })
]);

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

export { ServiceCommandTabComponent, serviceCommandTabFeatureProvider };
//# sourceMappingURL=c8y-ngx-components-services-service-command-tab.mjs.map
