import { DROPDOWN, INPUT } from '../../schemaComponentTypes';
import { SPECIAL_CHARACTERS_BLOCKLIST } from '../../regexConstants';
import { ALPHABETICAL, RANDOM } from '../../sorting';
import { productSliderSchema } from './product-slider';


const SORT_OPTION_LIST = [ALPHABETICAL, RANDOM];

export const productSimilarAppsSchemaForm = {
    sortBy: {
        title: 'uieditor.sfbComponent.productSimilarApps.sortBy.title',
        type: DROPDOWN,
        defaultValue: SORT_OPTION_LIST[0].value,
        options: SORT_OPTION_LIST,
        validation: {
            availableOptions: SORT_OPTION_LIST.map(({ value }) => value),
            message: 'uieditor.sfbComponent.dropdown.validation.message',
            default: 'uieditor.sfbComponent.dropdown.defaultValue'
        }
    },
    ...productSliderSchema,
    sliderTitle: {
        title: 'uieditor.sfbComponent.slider.sliderTitle.title',
        placeholder: 'uieditor.sfbComponent.slider.sliderTitle.placeholder',
        type: INPUT,
        required: false,
        validation: {
            pattern: SPECIAL_CHARACTERS_BLOCKLIST,
            message: 'uieditor.sfbComponent.input.validation.message'
        }
    }
};
