/**
 * Deprecated Quick Answer block versions.
 *
 * Currently only schemaVersion=1 exists; reserved for future migrations.
 */

import save from './save';

const deprecated = [
	{
		attributes: {
			schemaVersion: { type: 'number', default: 0 },
			label: { type: 'string', default: 'Quick answer' },
			answer: { type: 'string', default: '' },
			source: { type: 'string', default: '' },
			stylePreset: { type: 'string', default: 'clean' },
			colorPreset: { type: 'string', default: 'blue' },
			density: { type: 'string', default: 'comfortable' },
		},
		supports: {
			html: false,
			align: ['wide', 'full'],
			anchor: true,
		},
		migrate(attributes) {
			return {
				...attributes,
				schemaVersion: 1,
				label: attributes.label || 'Quick answer',
				answer: attributes.answer || '',
				source: attributes.source || '',
				stylePreset: attributes.stylePreset || 'clean',
				colorPreset: attributes.colorPreset || 'blue',
				density: attributes.density || 'comfortable',
			};
		},
		isEligible(attributes) {
			return !attributes || (attributes.schemaVersion || 0) < 1;
		},
		save: () => null,
	},
	{
		attributes: {
			schemaVersion: { type: 'number', default: 1 },
			label: { type: 'string', default: 'Quick answer' },
			answer: { type: 'string', default: '' },
			source: { type: 'string', default: '' },
			stylePreset: { type: 'string', default: 'clean' },
			colorPreset: { type: 'string', default: 'blue' },
			density: { type: 'string', default: 'comfortable' },
		},
		supports: {
			html: false,
			align: ['wide', 'full'],
			anchor: true,
		},
		save,
		isEligible() {
			return false;
		},
	},
];

export default deprecated;
