import { repeating, wrapper } from '@keystatic/core/content-components';
import { fields } from '@keystatic/core';
import { blocksIcon } from '@keystar/ui/icon/icons/blocksIcon';

const granularityComponents = {
  GranularityList: repeating({
    label: 'Rules Granularity',
    icon: blocksIcon,
    children: ['GranularityItem'],
    schema: {},
  }),
  GranularityItem: wrapper({
    label: 'GranularityItem',
    forSpecificLocations: true,
    schema: {
      category: fields.select({
        label: 'Granularity',
        options: [
          {
            label: 'Essential',
            value: 'essential',
          },
          {
            label: 'Intermediate',
            value: 'intermediate',
          },
          {
            label: 'Extended',
            value: 'extended',
          },
        ],
        defaultValue: 'intermediate',
      }),
    },
  }),
};

export default granularityComponents;
