import { ComponentStylingModel, ComponentStylingPropertiesControlComponent, genericPropertiesControlFor } from '@anglr/dynamic/layout-editor';
import { FormComponentControlType } from '../../../misc/enums';
import { FormGroupModel } from './formGroup.model';
/**
 * Form group layout metadata
 */
export class FormGroupLayoutEditorMetadata {
    //######################### constructor #########################
    constructor() {
        //######################### public properties - implementation of LayoutEditorMetadataDescriptor #########################
        /**
         * @inheritdoc
         */
        this.metaInfo = {
            name: 'Form group',
            description: 'Form group',
            group: 'Layout',
            optionsMetadata: {
                propertiesMetadata: [
                    {
                        modelType: ComponentStylingModel,
                        propertiesControls: [
                            ComponentStylingPropertiesControlComponent,
                        ],
                    },
                    {
                        modelType: FormGroupModel,
                        propertiesControls: [
                            genericPropertiesControlFor(['controlName'])
                        ],
                    },
                ]
            },
            defaultOptions: {
                controlType: FormComponentControlType.FormGroup
            }
        };
        /**
         * @inheritdoc
         */
        this.addDescendant = (metadata, options, index) => {
            var _a;
            (_a = options.children) !== null && _a !== void 0 ? _a : (options.children = []);
            options.children.splice(index, 0, metadata);
        };
        /**
         * @inheritdoc
         */
        this.canDropMetadata = () => true;
        /**
         * @inheritdoc
         */
        this.removeDescendant = (id, options) => {
            var _a;
            (_a = options.children) !== null && _a !== void 0 ? _a : (options.children = []);
            const index = options.children.findIndex(itm => itm.id === id);
            options.children.splice(index, 1);
        };
        Object.freeze(this);
    }
}
//# sourceMappingURL=formGroup.layoutMetadata.js.map