import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { LinkedCasesService } from '../../services/linked-cases.service';
import { AbstractJourneyComponent } from '../../../base-field';
import { MultipageComponentStateService } from '../../../../../services';
import * as i0 from "@angular/core";
import * as i1 from "@angular/router";
import * as i2 from "../../services/linked-cases.service";
import * as i3 from "../../../../../services";
import * as i4 from "@angular/common";
function NoLinkedCasesComponent_h1_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "h1", 9);
    i0.ɵɵtext(1, "There is a problem");
    i0.ɵɵelementEnd();
} }
function NoLinkedCasesComponent_p_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "p", 10)(1, "span", 11);
    i0.ɵɵtext(2, "Error:");
    i0.ɵɵelementEnd();
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate1(" ", ctx_r1.serverLinkedApiError.message, " ");
} }
function NoLinkedCasesComponent_ng_template_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "p", 5);
    i0.ɵɵtext(1, "There are no cases linked to this one.");
    i0.ɵɵelementEnd();
} }
export class NoLinkedCasesComponent extends AbstractJourneyComponent {
    router;
    linkedCasesService;
    serverLinkedApiError;
    constructor(router, linkedCasesService, multipageComponentStateService) {
        super(multipageComponentStateService);
        this.router = router;
        this.linkedCasesService = linkedCasesService;
    }
    ngOnInit() {
        this.serverLinkedApiError = this.linkedCasesService.serverLinkedApiError;
    }
    onBack() {
        this.router.navigate(['cases', 'case-details', this.linkedCasesService.caseJurisdictionID, this.linkedCasesService.caseDetails.case_type, this.linkedCasesService.caseId], { fragment: 'Linked cases' });
    }
    static ɵfac = function NoLinkedCasesComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || NoLinkedCasesComponent)(i0.ɵɵdirectiveInject(i1.Router), i0.ɵɵdirectiveInject(i2.LinkedCasesService), i0.ɵɵdirectiveInject(i3.MultipageComponentStateService)); };
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: NoLinkedCasesComponent, selectors: [["ccd-no-linked-cases"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 12, vars: 3, consts: [["noLinkedCases", ""], [1, "govuk-grid-row"], [1, "govuk-grid-column-full"], ["class", "govuk-heading-xl", 4, "ngIf"], ["id", "unlink-cases-error", "class", "govuk-error-message", 4, "ngIf", "ngIfElse"], [1, "govuk-body"], ["type", "button", 1, "govuk-js-link", 3, "click"], [1, "govuk-button-group"], ["type", "button", "id", "back-button", 1, "button", "button-primary", 3, "click"], [1, "govuk-heading-xl"], ["id", "unlink-cases-error", 1, "govuk-error-message"], [1, "govuk-visually-hidden"]], template: function NoLinkedCasesComponent_Template(rf, ctx) { if (rf & 1) {
            const _r1 = i0.ɵɵgetCurrentView();
            i0.ɵɵelementStart(0, "div", 1)(1, "div", 2);
            i0.ɵɵtemplate(2, NoLinkedCasesComponent_h1_2_Template, 2, 0, "h1", 3)(3, NoLinkedCasesComponent_p_3_Template, 4, 1, "p", 4)(4, NoLinkedCasesComponent_ng_template_4_Template, 2, 0, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
            i0.ɵɵelementStart(6, "p", 5)(7, "button", 6);
            i0.ɵɵlistener("click", function NoLinkedCasesComponent_Template_button_click_7_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onBack()); });
            i0.ɵɵtext(8, "Go back to the Linked cases tab");
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(9, "div", 7)(10, "button", 8);
            i0.ɵɵlistener("click", function NoLinkedCasesComponent_Template_button_click_10_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onBack()); });
            i0.ɵɵtext(11, "Back");
            i0.ɵɵelementEnd()()()();
        } if (rf & 2) {
            const noLinkedCases_r3 = i0.ɵɵreference(5);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("ngIf", ctx.serverLinkedApiError);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.serverLinkedApiError)("ngIfElse", noLinkedCases_r3);
        } }, dependencies: [i4.NgIf], encapsulation: 2 });
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NoLinkedCasesComponent, [{
        type: Component,
        args: [{ selector: 'ccd-no-linked-cases', template: "<div class=\"govuk-grid-row\">\n  <div class=\"govuk-grid-column-full\">\n    <h1 class=\"govuk-heading-xl\" *ngIf=\"serverLinkedApiError\">There is a problem</h1>\n    <p id=\"unlink-cases-error\" class=\"govuk-error-message\"\n      *ngIf=\"serverLinkedApiError;else noLinkedCases;\">\n      <span class=\"govuk-visually-hidden\">Error:</span> {{serverLinkedApiError.message}}\n    </p>\n    <ng-template #noLinkedCases>\n      <p class=\"govuk-body\">There are no cases linked to this one.</p>\n    </ng-template>\n    <p class=\"govuk-body\">\n      <button type=\"button\" class=\"govuk-js-link\" (click)=\"onBack()\">Go back to the Linked cases tab</button>\n    </p>\n    <div class=\"govuk-button-group\">\n      <button class=\"button button-primary\" type=\"button\" id=\"back-button\" (click)=\"onBack()\">Back</button>\n    </div>\n  </div>\n</div>\n" }]
    }], () => [{ type: i1.Router }, { type: i2.LinkedCasesService }, { type: i3.MultipageComponentStateService }], null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(NoLinkedCasesComponent, { className: "NoLinkedCasesComponent", filePath: "lib/shared/components/palette/linked-cases/components/no-linked-cases/no-linked-cases.component.ts", lineNumber: 12 }); })();
//# sourceMappingURL=data:application/json;base64, 