import { Component, Inject, Input, Optional } from '@angular/core';
import { getPropertyTuples, typeFilter } from '@aztrix/helpers';
import { PropertyType } from '@aztrix/models';
import { BASE_URL } from '@aztrix/sdk';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "./communication-icon/communication-icon.component";
import * as i3 from "@aztrix/components/property-view";
import * as i4 from "@angular/cdk/stepper";
import * as i5 from "@aztrix/components/content-stepper";
export class CommunicationComponent {
    constructor(baseUrl) {
        this.baseUrl = baseUrl;
    }
    get communicationProperties() {
        if (!this.profile || !this.communicationType) {
            return [];
        }
        return getPropertyTuples(this.profile.propertyContexts, typeFilter(this.communicationType)).map((tuple) => tuple.property);
    }
    notUseStepper() {
        if (this.communicationType === PropertyType.ADDRESS ||
            this.communicationType === PropertyType.LEGAL_ID) {
            if (this.communicationProperties.length <= 1) {
                return true;
            }
        }
        else {
            if (this.communicationProperties.length <= 3) {
                return true;
            }
        }
        return false;
    }
}
CommunicationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: CommunicationComponent, deps: [{ token: BASE_URL, optional: true }], target: i0.ɵɵFactoryTarget.Component });
CommunicationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.5", type: CommunicationComponent, selector: "ax-communication", inputs: { profile: "profile", communicationType: "communicationType" }, ngImport: i0, template: "<ng-template #line let-property>\n  <div class=\"wrapper\">\n    <ax-communication-icon class=\"icon\" [type]=\"communicationType\"></ax-communication-icon>\n    <ax-property-value-view [property]=\"property\" [clickable]=\"true\"></ax-property-value-view>\n  </div>\n</ng-template>\n\n<ng-container *ngIf=\"notUseStepper(); else stepper\">\n  <ng-container *ngFor=\"let property of communicationProperties\">\n    <ng-container *ngTemplateOutlet=\"line; context: {$implicit: property}\"></ng-container>\n  </ng-container>\n</ng-container>\n<ng-template #stepper>\n  <ng-container\n    *ngIf=\"communicationType !== 'ADDRESS' && communicationType !== 'LEGAL_ID'; else singleProp\"\n  >\n    <ax-content-stepper [mode]=\"'VERTICAL'\">\n      <ng-container *ngFor=\"let p of communicationProperties; let index = index\">\n        <cdk-step *ngIf=\"index % 3 === 0\">\n          <ng-container *ngFor=\"let property of communicationProperties.slice(index, index + 3)\">\n            <ng-container *ngTemplateOutlet=\"line; context: {$implicit: property}\"></ng-container>\n          </ng-container>\n        </cdk-step>\n      </ng-container>\n    </ax-content-stepper>\n  </ng-container>\n  <ng-template #singleProp>\n    <ax-content-stepper [mode]=\"'VERTICAL'\">\n      <ng-container *ngFor=\"let p of communicationProperties; let index = index\">\n        <cdk-step *ngIf=\"index % 1 === 0\">\n          <ng-container *ngFor=\"let property of communicationProperties.slice(index, index + 1)\">\n            <ng-container *ngTemplateOutlet=\"line; context: {$implicit: property}\"></ng-container>\n          </ng-container>\n        </cdk-step>\n      </ng-container>\n    </ax-content-stepper>\n  </ng-template>\n</ng-template>\n", styles: [":host{min-height:0}.wrapper{display:flex;margin:8px 16px 0}.wrapper ax-communication-icon{margin-right:8px}.link{line-height:1.5}.link:link,.link:visited,.link:hover,.link:active{color:var(--primary-color-500)}.link:hover{text-decoration:none}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2.CommunicationIconComponent, selector: "ax-communication-icon", inputs: ["type"], outputs: ["clicked"] }, { kind: "component", type: i3.PropertyValueViewComponent, selector: "ax-property-value-view", inputs: ["property", "showVerificationLabel", "clickable", "isIndividual", "params"] }, { kind: "component", type: i4.CdkStep, selector: "cdk-step", inputs: ["stepControl", "label", "errorMessage", "aria-label", "aria-labelledby", "state", "editable", "optional", "completed", "hasError"], outputs: ["interacted"], exportAs: ["cdkStep"] }, { kind: "component", type: i5.ContentStepperComponent, selector: "ax-content-stepper", inputs: ["mode", "interactable", "reverse"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: CommunicationComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-communication', template: "<ng-template #line let-property>\n  <div class=\"wrapper\">\n    <ax-communication-icon class=\"icon\" [type]=\"communicationType\"></ax-communication-icon>\n    <ax-property-value-view [property]=\"property\" [clickable]=\"true\"></ax-property-value-view>\n  </div>\n</ng-template>\n\n<ng-container *ngIf=\"notUseStepper(); else stepper\">\n  <ng-container *ngFor=\"let property of communicationProperties\">\n    <ng-container *ngTemplateOutlet=\"line; context: {$implicit: property}\"></ng-container>\n  </ng-container>\n</ng-container>\n<ng-template #stepper>\n  <ng-container\n    *ngIf=\"communicationType !== 'ADDRESS' && communicationType !== 'LEGAL_ID'; else singleProp\"\n  >\n    <ax-content-stepper [mode]=\"'VERTICAL'\">\n      <ng-container *ngFor=\"let p of communicationProperties; let index = index\">\n        <cdk-step *ngIf=\"index % 3 === 0\">\n          <ng-container *ngFor=\"let property of communicationProperties.slice(index, index + 3)\">\n            <ng-container *ngTemplateOutlet=\"line; context: {$implicit: property}\"></ng-container>\n          </ng-container>\n        </cdk-step>\n      </ng-container>\n    </ax-content-stepper>\n  </ng-container>\n  <ng-template #singleProp>\n    <ax-content-stepper [mode]=\"'VERTICAL'\">\n      <ng-container *ngFor=\"let p of communicationProperties; let index = index\">\n        <cdk-step *ngIf=\"index % 1 === 0\">\n          <ng-container *ngFor=\"let property of communicationProperties.slice(index, index + 1)\">\n            <ng-container *ngTemplateOutlet=\"line; context: {$implicit: property}\"></ng-container>\n          </ng-container>\n        </cdk-step>\n      </ng-container>\n    </ax-content-stepper>\n  </ng-template>\n</ng-template>\n", styles: [":host{min-height:0}.wrapper{display:flex;margin:8px 16px 0}.wrapper ax-communication-icon{margin-right:8px}.link{line-height:1.5}.link:link,.link:visited,.link:hover,.link:active{color:var(--primary-color-500)}.link:hover{text-decoration:none}\n"] }]
        }], ctorParameters: function () { return [{ type: undefined, decorators: [{
                    type: Optional
                }, {
                    type: Inject,
                    args: [BASE_URL]
                }] }]; }, propDecorators: { profile: [{
                type: Input
            }], communicationType: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 