import { serializeField } from './AirtableField';
import { SerializedModelProperties, } from './AirtableModel';
const SerializedTableProperties = [...SerializedModelProperties, 'name', 'description', 'url', 'primaryField', 'fields'];
export function serializeTable(airtableTable) {
    return SerializedTableProperties.reduce((accum, propertyName) => {
        if (propertyName === 'fields') {
            accum['fields'] = airtableTable['fields'].map(field => serializeField(field));
            return accum;
        }
        if (propertyName === 'primaryField') {
            accum[propertyName] = serializeField(airtableTable[propertyName]);
            return accum;
        }
        accum[propertyName] = airtableTable[propertyName];
        return accum;
    }, {});
}
//# sourceMappingURL=AirtableTable.js.map