import { AswQrcodeErrorCorrectionLevel } from '@asoftwareworld/qrcode';
import * as i0 from '@angular/core';
import { Injectable } from '@angular/core';
import * as i1 from '@angular/material/snack-bar';

/**
 * @license
 * Copyright ASW (A Software World) All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file
 */
function getConstatnts() {
    const titleMessages = {
        homeTitle: 'ASW | Form Builder',
        aboutUsTitle: 'ASW | About Us',
        contactUsTitle: 'ASW | Contact Us',
    };
    const accountValidationMessages = {
        name: [
            { type: 'required', message: 'Name is required.' },
            { type: 'minlength', message: 'Name must be at least 5 characters long.' },
            { type: 'maxlength', message: 'Name cannot be more than 25 characters long.' },
            { type: 'pattern', message: 'Your username must contain only numbers and letters.' }
        ],
        emailAddress: [
            { type: 'required', message: 'Email is required.' },
            { type: 'email', message: 'Please enter a valid email address.' },
            { type: 'pattern', message: 'Email format should be xyz@example.com.' }
        ],
        phoneNumber: [
            { type: 'required', message: 'Phone number is required.' },
            { type: 'minlength', message: 'Phone number must be at least 10 characters long.' },
            { type: 'maxlength', message: 'Phone number cannot be more than 10 characters long.' },
        ],
        message: [
            { type: 'required', message: 'Message is required.' },
            { type: 'minlength', message: 'Message must be at least 6 characters long.' },
            { type: 'maxlength', message: 'Message cannot be more than 255 characters long.' },
        ],
        label: [
            { type: 'required', message: 'Label is required.' },
            { type: 'minlength', message: 'Label must be at least 5 characters long.' },
            { type: 'maxlength', message: 'Label cannot be more than 25 characters long.' }
        ],
        maxlength: [
            { type: 'required', message: 'Maxlength is required.' },
            { type: 'pattern', message: 'Maxlength must contain only numbers.' },
        ],
        minlength: [
            { type: 'required', message: 'Minlength is required.' },
            { type: 'pattern', message: 'Minlength must contain only numbers.' },
        ],
        key: [
            { type: 'required', message: 'Option key is required.' },
            { type: 'minlength', message: 'Sorry, your option key must be between 1 and 50 characters long.' },
            { type: 'pattern', message: 'Sorry, only letters (a-z), numbers (0-9), and periods (- and _) are allowed.' },
            { type: 'unique', message: 'Option key is already exist. Try another.' }
        ],
        value: [
            { type: 'required', message: 'Option value is required.' },
            { type: 'minlength', message: 'Sorry, your option value must be between 1 and 999 characters long.' }
        ],
        searchAddress: [
            { type: 'unique', message: 'Searched address not found.' }
        ],
        id: [
            { type: 'required', message: 'Unique id is required.' }
        ],
        operationValue: [
            { type: 'required', message: 'Operation is required.' }
        ],
        control: [
            { type: 'required', message: 'Operator is required.' }
        ]
    };
    const columns = [
        {
            value: 'col-md-1',
            label: 'Column 1'
        },
        {
            value: 'col-md-2',
            label: 'Column 2'
        },
        {
            value: 'col-md-3',
            label: 'Column 3'
        },
        {
            value: 'col-md-4',
            label: 'Column 4'
        },
        {
            value: 'col-md-5',
            label: 'Column 5'
        },
        {
            value: 'col-md-6',
            label: 'Column 6'
        },
        {
            value: 'col-md-7',
            label: 'Column 7'
        },
        {
            value: 'col-md-8',
            label: 'Column 8'
        },
        {
            value: 'col-md-9',
            label: 'Column 9'
        },
        {
            value: 'col-md-10',
            label: 'Column 10'
        },
        {
            value: 'col-md-11',
            label: 'Column 11'
        },
        {
            value: 'col-md-12',
            label: 'Column 12'
        }
    ];
    const errorCorrectionLevels = [
        AswQrcodeErrorCorrectionLevel.LOW,
        AswQrcodeErrorCorrectionLevel.MEDIUM,
        AswQrcodeErrorCorrectionLevel.HIGH,
        AswQrcodeErrorCorrectionLevel.QUARTILE
    ];
    const operations = [
        {
            value: '+',
            label: 'Addition'
        },
        {
            value: '-',
            label: 'Subtraction'
        },
        {
            value: '*',
            label: 'Multiplication'
        },
        {
            value: '/',
            label: 'Division'
        },
    ];
    const dataTypes = {
        dataTypeString: 'string',
        dataTypeNumber: 'number',
        dataTypeBoolean: 'boolean'
    };
    const cssClass = {
        cssClassCardHidden: 'quote-card-hidden',
        cssClassCardVisible: 'quote-card-visible'
    };
    const matchPattern = {
        emailPattern: '^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$',
        passwordPattern: '((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{8,20})',
        phonePattern: '[6-9]\\d{9}',
        numberPattern: '^[0-9]*$'
    };
    const notificationMessage = {
        notificationDisplayDuration: 10000,
        errorNotification: 'There is some problem. Please contact to administrator',
        emailSuccessNotification: 'Thank you! Your message has been sent successfully.'
    };
    const messages = {
        waringMessage: 'Are you sure you want to remove this field?',
        optionKeyValidationMessage: 'That option key is already exist. Try another.'
    };
    const applicationConstants = {
        applicationTitle: 'ASW Form Build',
        titleMessages,
        accountValidationMessages,
        cssClass,
        dataTypes,
        matchPattern,
        notificationMessage,
        messages,
        columns,
        errorCorrectionLevels,
        operations
    };
    return applicationConstants;
}
const Constants = getConstatnts();

/**
 * @license
 * Copyright ASW (A Software World) All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file
 */
class NotificationService {
    constructor(snackBar) {
        this.snackBar = snackBar;
    }
    /* Method used notify message to user */
    openNotification(message, action) {
        this.snackBar.open(message, action, {
            duration: 15000
        });
    }
}
NotificationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: NotificationService, deps: [{ token: i1.MatSnackBar }], target: i0.ɵɵFactoryTarget.Injectable });
NotificationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: NotificationService, providedIn: 'root' });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: NotificationService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], ctorParameters: function () { return [{ type: i1.MatSnackBar }]; } });

/**
 * @license
 * Copyright ASW (A Software World) All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file
 */
class ObjectUtils {
    static keyPressNumbersWithDecimal(event) {
        const charCode = (event.which) ? event.which : event.keyCode;
        if (charCode !== 46 && charCode > 31
            && (charCode < 48 || charCode > 57)) {
            event.preventDefault();
            return false;
        }
        return true;
    }
    static resetForm(formContainer) {
        formContainer.forEach(control => {
            control.value = '';
            if (control.controlType === 'select'
                || control.controlType === 'multi-select'
                || control.controlType === 'radio'
                || control.controlType === 'checkbox'
                || control.controlType === 'autocomplete') {
                control.options.forEach((option) => {
                    option.isChecked = false;
                });
            }
        });
        return formContainer;
    }
    static validateForm(formContainer) {
        let isFormValid = true;
        const data = formContainer.filter(x => x.isRequired);
        const labels = [];
        data.forEach(control => {
            var _a;
            if (!((_a = control.value) === null || _a === void 0 ? void 0 : _a.length)) {
                isFormValid = false;
                labels.push(' ' + control.label);
            }
        });
        return { isFormValid, labels };
    }
    static calculateValue(operations) {
        let sum = operations[0].value;
        operations.forEach((operation, index) => {
            if (index !== 0) {
                switch (operation.operationValue) {
                    case '+':
                        sum += operation.value;
                        break;
                    case '-':
                        sum -= operation.value;
                        break;
                    case '*':
                        sum *= operation.value;
                        break;
                    case '/':
                        sum /= operation.value;
                        break;
                }
            }
        });
        return sum;
    }
}

/**
 * @license
 * Copyright ASW (A Software World) All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file
 */

/**
 * Generated bundle index. Do not edit.
 */

export { Constants, NotificationService, ObjectUtils };
//# sourceMappingURL=asoftwareworld-form-builder-form-control-core.mjs.map
