var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Component, ChangeDetectionStrategy } from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { RegisterClass } from '@memberjunction/global';
import { BaseResourceComponent } from '@memberjunction/ng-shared';
import * as i0 from "@angular/core";
import * as i1 from "@memberjunction/ng-testing";
import * as i2 from "@memberjunction/ng-versions";
import * as i3 from "./testing-dashboard-tab.component";
function TestingDashboardTabResourceComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    const _r1 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "mj-slide-panel", 2);
    i0.ɵɵlistener("Closed", function TestingDashboardTabResourceComponent_Conditional_2_Template_mj_slide_panel_Closed_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnPanelClosed()); });
    i0.ɵɵelementStart(1, "app-test-run-dialog", 3);
    i0.ɵɵlistener("PanelClose", function TestingDashboardTabResourceComponent_Conditional_2_Template_app_test_run_dialog_PanelClose_1_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnPanelClosed()); });
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵproperty("Title", (ctx_r1.testingDialogService.PanelOptions == null ? null : ctx_r1.testingDialogService.PanelOptions.testId) ? "Test Execution" : "Run Test")("Resizable", true);
    i0.ɵɵadvance();
    i0.ɵɵproperty("PanelMode", true)("selectedTestId", (ctx_r1.testingDialogService.PanelOptions == null ? null : ctx_r1.testingDialogService.PanelOptions.testId) ?? null)("selectedSuiteId", (ctx_r1.testingDialogService.PanelOptions == null ? null : ctx_r1.testingDialogService.PanelOptions.suiteId) ?? null)("runMode", (ctx_r1.testingDialogService.PanelOptions == null ? null : ctx_r1.testingDialogService.PanelOptions.mode) ?? "test");
} }
/**
 * Testing Dashboard Tab Resource - displays the main dashboard overview
 */
let TestingDashboardTabResourceComponent = class TestingDashboardTabResourceComponent extends BaseResourceComponent {
    testingDialogService;
    cdr;
    destroy$ = new Subject();
    constructor(testingDialogService, cdr) {
        super();
        this.testingDialogService = testingDialogService;
        this.cdr = cdr;
    }
    ngOnInit() {
        this.testingDialogService.PanelStateChanged$.pipe(takeUntil(this.destroy$)).subscribe(() => {
            this.cdr.detectChanges();
        });
        this.NotifyLoadComplete();
    }
    ngOnDestroy() {
        this.destroy$.next();
        this.destroy$.complete();
    }
    OnPanelClosed() {
        this.testingDialogService.ClosePanel();
        this.cdr.markForCheck();
    }
    async GetResourceDisplayName(data) {
        return 'Overview';
    }
    async GetResourceIconClass(data) {
        return 'fa-solid fa-gauge-high';
    }
    static ɵfac = function TestingDashboardTabResourceComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TestingDashboardTabResourceComponent)(i0.ɵɵdirectiveInject(i1.TestingDialogService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TestingDashboardTabResourceComponent, selectors: [["mj-testing-dashboard-tab-resource"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 3, vars: 1, consts: [[1, "resource-container"], ["Mode", "slide", 3, "Title", "Resizable"], ["Mode", "slide", 3, "Closed", "Title", "Resizable"], [3, "PanelClose", "PanelMode", "selectedTestId", "selectedSuiteId", "runMode"]], template: function TestingDashboardTabResourceComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "div", 0);
            i0.ɵɵelement(1, "app-testing-dashboard-tab");
            i0.ɵɵelementEnd();
            i0.ɵɵconditionalCreate(2, TestingDashboardTabResourceComponent_Conditional_2_Template, 2, 6, "mj-slide-panel", 1);
        } if (rf & 2) {
            i0.ɵɵadvance(2);
            i0.ɵɵconditional(ctx.testingDialogService.IsPanelOpen ? 2 : -1);
        } }, dependencies: [i1.TestRunDialogComponent, i2.MjSlidePanelComponent, i3.TestingDashboardTabComponent], styles: [".resource-container[_ngcontent-%COMP%] {\n      width: 100%;\n      height: 100%;\n      overflow: auto;\n    }"], changeDetection: 0 });
};
TestingDashboardTabResourceComponent = __decorate([
    RegisterClass(BaseResourceComponent, 'TestingDashboardTabResource')
], TestingDashboardTabResourceComponent);
export { TestingDashboardTabResourceComponent };
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TestingDashboardTabResourceComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'mj-testing-dashboard-tab-resource', changeDetection: ChangeDetectionStrategy.OnPush, template: `
    <div class="resource-container">
      <app-testing-dashboard-tab></app-testing-dashboard-tab>
    </div>

    <!-- Slide Panel for Test Execution -->
    @if (testingDialogService.IsPanelOpen) {
      <mj-slide-panel
        Mode="slide"
        [Title]="testingDialogService.PanelOptions?.testId ? 'Test Execution' : 'Run Test'"
        [Resizable]="true"
        (Closed)="OnPanelClosed()">
        <app-test-run-dialog
          [PanelMode]="true"
          [selectedTestId]="testingDialogService.PanelOptions?.testId ?? null"
          [selectedSuiteId]="testingDialogService.PanelOptions?.suiteId ?? null"
          [runMode]="testingDialogService.PanelOptions?.mode ?? 'test'"
          (PanelClose)="OnPanelClosed()">
        </app-test-run-dialog>
      </mj-slide-panel>
    }
  `, styles: ["\n    .resource-container {\n      width: 100%;\n      height: 100%;\n      overflow: auto;\n    }\n  "] }]
    }], () => [{ type: i1.TestingDialogService }, { type: i0.ChangeDetectorRef }], null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TestingDashboardTabResourceComponent, { className: "TestingDashboardTabResourceComponent", filePath: "src/Testing/components/testing-dashboard-tab-resource.component.ts", lineNumber: 47 }); })();
//# sourceMappingURL=testing-dashboard-tab-resource.component.js.map