import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, } from '@angular/core';
import { CustomValidators, PropertyFormControl } from '@aztrix/helpers';
import { PropertyType } from '@aztrix/models';
import * as i0 from "@angular/core";
import * as i1 from "@aztrix/components/property-edit";
import * as i2 from "@aztrix/components/button";
import * as i3 from "@aztrix/helpers";
export class SendToEmailComponent {
    constructor() {
        this.didClickSend = new EventEmitter();
        this.form = PropertyFormControl.createByType(PropertyType.EMAIL, CustomValidators.propertyValid);
    }
    sendEmail() {
        this.didClickSend.emit(this.form.value.value);
    }
    ngOnChanges(changes) {
        if (changes.email && this.email) {
            this.form.get('value')?.setValue(this.email);
            this.form.markAsDirty();
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SendToEmailComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: SendToEmailComponent, selector: "ax-send-to-email", inputs: { hint: "hint", email: "email" }, outputs: { didClickSend: "didClickSend" }, usesOnChanges: true, ngImport: i0, template: "<ax-property-edit [form]=\"form\" [autofocus]=\"false\" [hint]=\"hint\"></ax-property-edit>\n<div class=\"h-button-wrapper\">\n  <button axButton filled color=\"primary\" [disabled]=\"!form.valid\" (click)=\"sendEmail()\">\n    {{ 'label.send' | translate }}\n  </button>\n</div>\n", styles: [":host{display:block;padding:1rem}@media only screen and (min-width: 600px){:host{display:flex;align-items:center}}:host ax-property-edit{flex:1 0 auto;margin-right:1rem}\n"], dependencies: [{ kind: "component", type: i1.PropertyEditComponent, selector: "ax-property-edit", inputs: ["isIndividual", "isProposalSubscribeForm"] }, { kind: "directive", type: i2.ButtonDirective, selector: "[axButton]", inputs: ["color", "labelHideMobile", "smallButton", "bigButton", "fullWidth", "filled", "outline", "icon-button", "hoverLabel", "hover", "lowercase", "disabled"] }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SendToEmailComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-send-to-email', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ax-property-edit [form]=\"form\" [autofocus]=\"false\" [hint]=\"hint\"></ax-property-edit>\n<div class=\"h-button-wrapper\">\n  <button axButton filled color=\"primary\" [disabled]=\"!form.valid\" (click)=\"sendEmail()\">\n    {{ 'label.send' | translate }}\n  </button>\n</div>\n", styles: [":host{display:block;padding:1rem}@media only screen and (min-width: 600px){:host{display:flex;align-items:center}}:host ax-property-edit{flex:1 0 auto;margin-right:1rem}\n"] }]
        }], propDecorators: { hint: [{
                type: Input
            }], email: [{
                type: Input
            }], didClickSend: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VuZC10by1lbWFpbC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL2NvbXBvbmVudHMvc2VuZC10by1lbWFpbC9zZW5kLXRvLWVtYWlsLmNvbXBvbmVudC50cyIsIi4uLy4uLy4uLy4uLy4uL2xpYnMvY29tcG9uZW50cy9zZW5kLXRvLWVtYWlsL3NlbmQtdG8tZW1haWwuY29tcG9uZW50Lmh0bWwiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLHVCQUF1QixFQUN2QixTQUFTLEVBQ1QsWUFBWSxFQUNaLEtBQUssRUFFTCxNQUFNLEdBRVAsTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUFDLGdCQUFnQixFQUFFLG1CQUFtQixFQUFDLE1BQU0saUJBQWlCLENBQUM7QUFDdEUsT0FBTyxFQUFDLFlBQVksRUFBQyxNQUFNLGdCQUFnQixDQUFDOzs7OztBQVE1QyxNQUFNLE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