import type { ComponentSchema } from '@keystatic/core';
import { fields } from '@keystatic/core';

export const createSEOField = (): ComponentSchema =>
  fields.object(
    {
      title: fields.text({
        label: 'SEO Title',
        validation: { length: { max: 60 } },
      }),
      description: fields.text({
        label: 'SEO Description',
        multiline: true,
        validation: { length: { max: 160 } },
      }),
      noIndex: fields.checkbox({
        label: 'No Index',
        description: 'Prevent search engines from indexing',
      }),
    },
    {
      label: 'SEO Settings',
    }
  );
