In that code can you help me modify that fields in order to be cappable of recursive? "   const fields =
      this.getConfigurationsForm().value.type === 'automatic'
        ? (this.fileSchema()?.fields as any)
        : (this.schemaConfig.map((response: SchemaField) => {
            let field: SchemaFieldResponse = {
              name: response.name,
              col: {
                type: response.type,
                generator: { ...response.schema },
              },
            };

            if (response.type === FieldTypes.Decimal) {
              field.col.scale = response.schema['scale'];
              delete field.col.generator!['scale'];
            } else if (
              response.type === FieldTypes.Date ||
              response.type === FieldTypes.DateTime ||
              response.type === FieldTypes.Time
            ) {
              field.col.pattern = response.schema['pattern'];
              delete field.col.generator!['pattern'];
            } else if (response.type === FieldTypes.Array) {
              field = {
                name: response.name,
                col: {
                  type: FieldTypes.Array,
                  length: response.arrayLength,
                  col: {
                    type: response.schema['col'][0].type,
                    generator: { ...response.schema['col'][0].schema },
                  },
                },
              };

              if (response.schema['col'][0].type === FieldTypes.Decimal) {
                field.col.col!.scale = response.schema['col'][0].schema.scale;
                delete field.col.col!.generator!['scale'];
              } else if (
                response.schema['col'][0].type === FieldTypes.Date ||
                response.schema['col'][0].type === FieldTypes.DateTime ||
                response.schema['col'][0].type === FieldTypes.Time
              ) {
                field.col.col!.pattern =
                  response.schema['col'][0].schema.pattern;
                delete field.col.col!.generator!['pattern'];
              }
            } else if (response.type === FieldTypes.Optional) {
              field = {
                name: response.name,
                col: {
                  type: FieldTypes.Optional,
                  null_probability: response.nullProbability,
                  col: {
                    type: response.schema['col'][0].type,
                    generator: { ...response.schema['col'][0].schema },
                  },
                },
              };

              if (response.schema['col'][0].type === FieldTypes.Decimal) {
                field.col.col!.scale = response.schema['col'][0].schema.scale;
                delete field.col.col!.generator!['scale'];
              } else if (
                response.schema['col'][0].type === FieldTypes.Date ||
                response.schema['col'][0].type === FieldTypes.DateTime ||
                response.schema['col'][0].type === FieldTypes.Time
              ) {
                field.col.col!.pattern =
                  response.schema['col'][0].schema.pattern;
                delete field.col.col!.generator!['pattern'];
              }
            }

            return field;
          }) as SchemaFieldResponse[]);". and those are all the interfaces "import { FormArray, FormControl, FormGroup } from '@angular/forms';
import {
  FieldTypes,
  GeneratorType,
} from '../../schema-config/schema-config.model';

export interface SchemaField {
  name: string;
  type: FieldTypes;
  schema: {
    type: GeneratorType;
    [key: string]: any;
    nestedSchema: SchemaField[];
  };
  arrayLength: number;
  nullProbability: number;
}

export interface SchemaFieldResponse {
  name: string;
  col: {
    type: FieldTypes;
    generator?: {
      type: GeneratorType;
      [key: string]: any;
    };
    scale?: number;
    pattern?: string;
    length?: number;
    null_probability?: number;
    col?: SchemaFieldResponse['col'];
  };
}

export interface SchemaFieldFormGroup {
  name: FormControl<string>;
  type: FormControl<FieldTypes | null>;
  schema: FormControl<Record<string, any> | null>;
  arrayLength?: FormControl<number>;
  nullProbability?: FormControl<number>;
}

export interface SchemaConfigForm {
  generatorsArray: FormArray<FormGroup<SchemaFieldFormGroup>>;
}

export interface Schema {
  num_records: number;
  schema: {
    fields: SchemaFieldResponse[];
  };
  data_format: {
    type: 'json_lines' | 'xml_lines' | 'csv_lines';
  };
  output: {
    type: 'console' | 'PubSub' | 'big_query_table';
    dataset: string;
    table: string;
    saving_mode: {
      type: 'batch' | 'streaming';
      delay: number;
      num_of_records: number;
    };
  };
}
". As you see array and Optional can have nestedSchemas that means that contains normal fields like date or decimal but an array can contain another optional and currently algorithm only check the first layer and the second layer contains the schema with nestedSchema Object which it's not okay. I need something recursive