import { NgModule } from '@angular/core';
import { FORMLY_CONFIG } from '@ngx-formly/core';
import { FormlyPresetModule } from '@ngx-formly/core/preset';
import { Mode } from '@c8y/ngx-components/protocol-lwm2m/model';
import { Lwm2mFilePickAndReplaceType } from './lwm2m-file-pick-and-replace.type.component';
import { Lwm2mInputGroupAddonType } from './lwm2m-input-group-addon.type.component';
import { gettext, CommonModule as C8yCommonModule, FormsModule as C8yFormsModule, DynamicFormsModule, LegendFieldWrapper } from '@c8y/ngx-components';
import * as i0 from "@angular/core";
export class Lwm2mUIThemeModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: Lwm2mUIThemeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.9", ngImport: i0, type: Lwm2mUIThemeModule, declarations: [Lwm2mFilePickAndReplaceType, Lwm2mInputGroupAddonType], imports: [C8yCommonModule, C8yFormsModule, DynamicFormsModule, FormlyPresetModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: Lwm2mUIThemeModule, providers: [
            {
                provide: FORMLY_CONFIG,
                multi: true,
                useValue: {
                    wrappers: [
                        {
                            name: 'legend',
                            component: LegendFieldWrapper
                        }
                    ],
                    presets: [
                        {
                            name: 'securityMode',
                            config: {
                                key: 'mode',
                                type: 'select',
                                defaultValue: Mode.NO_SEC,
                                props: {
                                    label: gettext('Mode')
                                }
                            }
                        },
                        {
                            name: 'pskId',
                            config: {
                                key: 'pskId',
                                type: 'string',
                                props: {
                                    label: gettext('PSK ID'),
                                    required: true
                                },
                                expressions: {
                                    'props.disabled': (field) => field?.options?.formState?.disabled,
                                    hide: (field) => {
                                        return field.model?.mode !== Mode.PSK;
                                    }
                                }
                            }
                        },
                        {
                            name: 'pskKey',
                            config: {
                                key: 'pskKey',
                                type: 'string',
                                props: {
                                    label: gettext('Pre-shared key'),
                                    placeholder: '0123456789abcdef',
                                    pattern: '^([a-fA-F0-9]{2})+$',
                                    required: true
                                },
                                expressions: {
                                    'props.disabled': (field) => field?.options?.formState?.disabled,
                                    hide: (field) => {
                                        return field.model?.mode !== Mode.PSK;
                                    }
                                }
                            }
                        }
                    ],
                    types: [
                        {
                            name: 'switch',
                            extends: 'checkbox',
                            defaultOptions: {
                                props: {
                                    switchMode: true,
                                    indeterminate: false
                                }
                            }
                        },
                        {
                            name: 'file-pick-replace',
                            component: Lwm2mFilePickAndReplaceType,
                            wrappers: ['c8y-form-field']
                        },
                        {
                            name: 'input-addon',
                            component: Lwm2mInputGroupAddonType,
                            wrappers: ['c8y-form-field']
                        }
                    ],
                    validationMessages: [
                        {
                            name: 'invalidType',
                            message: gettext('The selected file is not supported.')
                        },
                        {
                            name: 'strReplaceError',
                            message: gettext('The selected file is not processable.')
                        }
                    ]
                }
            }
        ], imports: [C8yCommonModule, C8yFormsModule, DynamicFormsModule, FormlyPresetModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: Lwm2mUIThemeModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [C8yCommonModule, C8yFormsModule, DynamicFormsModule, FormlyPresetModule],
                    declarations: [Lwm2mFilePickAndReplaceType, Lwm2mInputGroupAddonType],
                    providers: [
                        {
                            provide: FORMLY_CONFIG,
                            multi: true,
                            useValue: {
                                wrappers: [
                                    {
                                        name: 'legend',
                                        component: LegendFieldWrapper
                                    }
                                ],
                                presets: [
                                    {
                                        name: 'securityMode',
                                        config: {
                                            key: 'mode',
                                            type: 'select',
                                            defaultValue: Mode.NO_SEC,
                                            props: {
                                                label: gettext('Mode')
                                            }
                                        }
                                    },
                                    {
                                        name: 'pskId',
                                        config: {
                                            key: 'pskId',
                                            type: 'string',
                                            props: {
                                                label: gettext('PSK ID'),
                                                required: true
                                            },
                                            expressions: {
                                                'props.disabled': (field) => field?.options?.formState?.disabled,
                                                hide: (field) => {
                                                    return field.model?.mode !== Mode.PSK;
                                                }
                                            }
                                        }
                                    },
                                    {
                                        name: 'pskKey',
                                        config: {
                                            key: 'pskKey',
                                            type: 'string',
                                            props: {
                                                label: gettext('Pre-shared key'),
                                                placeholder: '0123456789abcdef',
                                                pattern: '^([a-fA-F0-9]{2})+$',
                                                required: true
                                            },
                                            expressions: {
                                                'props.disabled': (field) => field?.options?.formState?.disabled,
                                                hide: (field) => {
                                                    return field.model?.mode !== Mode.PSK;
                                                }
                                            }
                                        }
                                    }
                                ],
                                types: [
                                    {
                                        name: 'switch',
                                        extends: 'checkbox',
                                        defaultOptions: {
                                            props: {
                                                switchMode: true,
                                                indeterminate: false
                                            }
                                        }
                                    },
                                    {
                                        name: 'file-pick-replace',
                                        component: Lwm2mFilePickAndReplaceType,
                                        wrappers: ['c8y-form-field']
                                    },
                                    {
                                        name: 'input-addon',
                                        component: Lwm2mInputGroupAddonType,
                                        wrappers: ['c8y-form-field']
                                    }
                                ],
                                validationMessages: [
                                    {
                                        name: 'invalidType',
                                        message: gettext('The selected file is not supported.')
                                    },
                                    {
                                        name: 'strReplaceError',
                                        message: gettext('The selected file is not processable.')
                                    }
                                ]
                            }
                        }
                    ]
                }]
        }] });
//# sourceMappingURL=data:application/json;base64, 