import { Component, EventEmitter, Input, Output } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "../services/node-management.service";
import * as i2 from "../services/swimlane.service";
import * as i3 from "@angular/common";
import * as i4 from "verben-ng-ui";
export class DesignerToolbarComponent {
    nodeService;
    swimlaneService;
    selectedTool = null;
    isSaving = false;
    toolSelected = new EventEmitter();
    saveWorkflow = new EventEmitter();
    // Simple array of toolbar items
    toolbarItems = [
        { id: 'swimlane', label: 'Swimlane' },
        { id: 'stage', label: 'Stage' },
        // { id: 'action', label: 'Action' },
        // { id: 'form', label: 'Form' },
        { id: 'decision', label: 'Decision' },
        // { id: 'subflow', label: 'Subflow' },
    ];
    constructor(nodeService, swimlaneService) {
        this.nodeService = nodeService;
        this.swimlaneService = swimlaneService;
    }
    /**
     * Handle tool button click
     */
    onToolClick(tool) {
        this.toolSelected.emit(tool);
    }
    /**
     * Check if a tool should be enabled
     */
    isEnabled(type) {
        switch (type) {
            case 'swimlane':
                return true; // Always enabled
            case 'stage':
            case 'decision':
                // Enabled if there are swimlanes available
                return this.swimlaneService.getSwimlanes().length > 0;
            case 'form':
            case 'action':
            case 'subflow':
                // Only enabled if there are nodes in the workflow
                return this.nodeService.getNodeCount() > 0;
            default:
                return false;
        }
    }
    /**
     * Handle save button click
     */
    onSaveClick() {
        this.saveWorkflow.emit();
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DesignerToolbarComponent, deps: [{ token: i1.NodeManagementService }, { token: i2.SwimlaneService }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: DesignerToolbarComponent, selector: "lib-designer-toolbar", inputs: { selectedTool: "selectedTool", isSaving: "isSaving" }, outputs: { toolSelected: "toolSelected", saveWorkflow: "saveWorkflow" }, ngImport: i0, template: "<div class=\"designer-toolbar\">\n  <div class=\"toolbar-container\">\n    <button\n      *ngFor=\"let item of toolbarItems\"\n      class=\"tool-button\"\n      [class.active]=\"selectedTool === item.id\"\n      [class.disabled]=\"!isEnabled(item.id)\"\n      (click)=\"onToolClick(item.id)\"\n      [title]=\"item.label\"\n      [disabled]=\"!isEnabled(item.id)\"\n      style=\"width: 60px; height: auto\"\n    >\n      <!-- {{ item.label }} -->\n      <img\n        [src]=\"'icons/' + item.id + '.svg'\"\n        [alt]=\"item.label\"\n        class=\"tool-icon\"\n      />\n    </button>\n  </div>\n\n  <!-- <button class=\"save-button\" (click)=\"onSaveClick()\" [disabled]=\"isSaving\">\n    {{ isSaving ? \"Saving...\" : \"Save Workflow\" }}\n  </button> -->\n\n  <verbena-button\n    buttonClass=\"save-button\"\n    (click)=\"onSaveClick()\"\n    [isLoading]=\"isSaving\"\n    type=\"submit\"\n    text=\"Save\"\n    bgColor=\"#FFE681\"\n    textColor=\"#404040\"\n    borderRadius=\"10px\"\n    pd=\"10px 20px\"\n    width=\"114px\"\n    height=\"39px\"\n  ></verbena-button>\n</div>\n", styles: [".designer-toolbar{padding:.5rem;background-color:#fff;border-bottom:1px solid #e2e8f0;display:flex;justify-content:space-between;align-items:center}.toolbar-container{display:flex;gap:.5rem;background-color:#fff;border:1px solid #d8b4fe;border-radius:.5rem;padding:.5rem;box-shadow:0 2px 4px #0000001a;max-width:fit-content}.tool-button{padding:.5rem 1rem;background-color:#fff;border:1px solid #e2e8f0;border-radius:.25rem;cursor:pointer;font-size:.875rem;transition:all .2s}.tool-button:hover{background-color:#f9fafb}.tool-button.active{background-color:#f3e8ff;border-color:#d8b4fe;color:#7e22ce}.tool-button.active{opacity:.75}.save-button{padding:.5rem 1rem;background-color:#f3e8ff;border:1px solid #d8b4fe;border-radius:.25rem;color:#7e22ce;font-size:.875rem;cursor:pointer;transition:all .2s}.save-button:hover{background-color:#e9d5ff}.save-button:disabled{opacity:.5;cursor:not-allowed}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i4.VerbenaButtonComponent, selector: "verbena-button", inputs: ["text", "icon", "useIcon", "svgPosition", "iconPosition", "bgColor", "textColor", "border", "borderRadius", "pd", "width", "height", "fontSize", "fontWeight", "disable", "svgSize", "weight", "variant", "styleType", "svg", "svgWidth", "svgHeight", "iconColor", "svgColor", "buttonClass", "buttonTextClass", "isLoading", "spinnerSize", "spinnerColor"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DesignerToolbarComponent, decorators: [{
            type: Component,
            args: [{ selector: 'lib-designer-toolbar', template: "<div class=\"designer-toolbar\">\n  <div class=\"toolbar-container\">\n    <button\n      *ngFor=\"let item of toolbarItems\"\n      class=\"tool-button\"\n      [class.active]=\"selectedTool === item.id\"\n      [class.disabled]=\"!isEnabled(item.id)\"\n      (click)=\"onToolClick(item.id)\"\n      [title]=\"item.label\"\n      [disabled]=\"!isEnabled(item.id)\"\n      style=\"width: 60px; height: auto\"\n    >\n      <!-- {{ item.label }} -->\n      <img\n        [src]=\"'icons/' + item.id + '.svg'\"\n        [alt]=\"item.label\"\n        class=\"tool-icon\"\n      />\n    </button>\n  </div>\n\n  <!-- <button class=\"save-button\" (click)=\"onSaveClick()\" [disabled]=\"isSaving\">\n    {{ isSaving ? \"Saving...\" : \"Save Workflow\" }}\n  </button> -->\n\n  <verbena-button\n    buttonClass=\"save-button\"\n    (click)=\"onSaveClick()\"\n    [isLoading]=\"isSaving\"\n    type=\"submit\"\n    text=\"Save\"\n    bgColor=\"#FFE681\"\n    textColor=\"#404040\"\n    borderRadius=\"10px\"\n    pd=\"10px 20px\"\n    width=\"114px\"\n    height=\"39px\"\n  ></verbena-button>\n</div>\n", styles: [".designer-toolbar{padding:.5rem;background-color:#fff;border-bottom:1px solid #e2e8f0;display:flex;justify-content:space-between;align-items:center}.toolbar-container{display:flex;gap:.5rem;background-color:#fff;border:1px solid #d8b4fe;border-radius:.5rem;padding:.5rem;box-shadow:0 2px 4px #0000001a;max-width:fit-content}.tool-button{padding:.5rem 1rem;background-color:#fff;border:1px solid #e2e8f0;border-radius:.25rem;cursor:pointer;font-size:.875rem;transition:all .2s}.tool-button:hover{background-color:#f9fafb}.tool-button.active{background-color:#f3e8ff;border-color:#d8b4fe;color:#7e22ce}.tool-button.active{opacity:.75}.save-button{padding:.5rem 1rem;background-color:#f3e8ff;border:1px solid #d8b4fe;border-radius:.25rem;color:#7e22ce;font-size:.875rem;cursor:pointer;transition:all .2s}.save-button:hover{background-color:#e9d5ff}.save-button:disabled{opacity:.5;cursor:not-allowed}\n"] }]
        }], ctorParameters: () => [{ type: i1.NodeManagementService }, { type: i2.SwimlaneService }], propDecorators: { selectedTool: [{
                type: Input
            }], isSaving: [{
                type: Input
            }], toolSelected: [{
                type: Output
            }], saveWorkflow: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64, 