import { componentBlockFieldType } from './component-block.js';
/** Built-in field type definitions keyed by type discriminator. */
export const BUILT_IN_FIELDS = {
    text: {
        type: 'text',
        label: 'Text',
        defaultConfig: { type: 'text', label: 'Text' },
        validate: (value) => typeof value === 'string' || 'Must be a string',
    },
    richText: {
        type: 'richText',
        label: 'Rich Text',
        defaultConfig: {
            type: 'richText',
            label: 'Rich Text',
            features: ['bold', 'italic', 'link', 'heading', 'list'],
        },
    },
    number: {
        type: 'number',
        label: 'Number',
        defaultConfig: { type: 'number', label: 'Number' },
        validate: (value) => typeof value === 'number' || 'Must be a number',
    },
    boolean: {
        type: 'boolean',
        label: 'Boolean',
        defaultConfig: { type: 'boolean', label: 'Boolean' },
    },
    date: {
        type: 'date',
        label: 'Date',
        defaultConfig: { type: 'date', label: 'Date' },
    },
    slug: {
        type: 'slug',
        label: 'Slug',
        defaultConfig: { type: 'slug', label: 'Slug', from: 'title' },
    },
    select: {
        type: 'select',
        label: 'Select',
        defaultConfig: { type: 'select', label: 'Select', options: [] },
    },
    relationship: {
        type: 'relationship',
        label: 'Relationship',
        defaultConfig: { type: 'relationship', label: 'Relationship', relationTo: '' },
    },
    media: {
        type: 'media',
        label: 'Media',
        defaultConfig: { type: 'media', label: 'Media' },
    },
    json: {
        type: 'json',
        label: 'JSON',
        defaultConfig: { type: 'json', label: 'JSON' },
    },
    color: {
        type: 'color',
        label: 'Color',
        defaultConfig: { type: 'color', label: 'Color', format: 'hex' },
    },
    url: {
        type: 'url',
        label: 'URL',
        defaultConfig: { type: 'url', label: 'URL' },
    },
    email: {
        type: 'email',
        label: 'Email',
        defaultConfig: { type: 'email', label: 'Email' },
    },
    array: {
        type: 'array',
        label: 'Array',
        defaultConfig: { type: 'array', label: 'Array', fields: {} },
    },
    blocks: {
        type: 'blocks',
        label: 'Blocks',
        defaultConfig: { type: 'blocks', label: 'Blocks', blocks: [] },
    },
    componentBlock: componentBlockFieldType,
};
export function getFieldType(type) {
    return BUILT_IN_FIELDS[type];
}
export function getAllFieldTypes() {
    return Object.values(BUILT_IN_FIELDS);
}
export { titleField, slugField, pagePathField, excerptField, richContentField, featuredImageField, categoryField, tagsField, publishedDateField, authorField, quoteField, ctaField, seoFields, locationFields, geoFields, priceFields, relationField, relatedDocsField, } from './presets.js';
export { collectRelationRefs, validateRelations, populateRelations, parsePopulateParam, } from './relations.js';
//# sourceMappingURL=index.js.map