/**
 * Copyright 2018 Google Inc. All Rights Reserved.
 * Use of this source code is governed by an MIT-style license that
 * can be found in the LICENSE file at http://angular.io/license
 *
 * This file is derived from Angular examples.
 * Source: https://angular.io
 */

import { Component } from "@angular/core";
import { FieldType, FieldTypeConfig } from "@ngx-formly/core";

@Component({
  // selector: 'formly-object-type',
  template: `
    <div class="mb-3">
      <legend *ngIf="props.label">{{ props.label }}</legend>
      <p *ngIf="props.description">{{ props.description }}</p>
      <div
        class="alert alert-danger"
        role="alert"
        *ngIf="showError && formControl.errors">
        <formly-validation-message [field]="field"></formly-validation-message>
      </div>
      <formly-field
        *ngFor="let f of field.fieldGroup"
        [field]="f"></formly-field>
    </div>
  `,
  standalone: false,
})
export class ObjectTypeComponent extends FieldType<FieldTypeConfig> {
  defaultOptions = {
    defaultValue: {},
  };
}
