/**
 * BLOCK: Fields Settings
 */

import {__} from '@wordpress/i18n';

export const fields = {
		title: {
			type: 'text',
			label: __('Block Title', 'flo'),
			conditional: 0,
		},
		titleTypography: {
			type: 'typography',
			label: __('Title Typography', 'flo'),
		},
		titleDecorativeIcon: {
			type: 'image',
			label: __('Title Decorative Image', 'flo'),
		},
		list: {
			type: 'repeater',
			label: __('List', 'flo'),
			row_title: '',
			fields: {
				items: {
					type: 'repeater',
					label: __('Items', 'flo'),
					row_title: 'question',
					fields: {
						question: {
							id: 'question',
							type: 'textarea',
							label: __('Question', 'flo'),
							default: __('Question', 'flo'),
						},
						answer: {
							id: 'answer',
							type: 'textarea',
							label: __('Answer', 'flo'),
							default: __('Answer', 'flo'),
						},
					},
					default: [],
				},
				image: {
					type: 'image',
					label: __('Image', 'flo'),
					default: {
						url: '',
					},
				},
			},
		},
		questionTypography: {
			type: 'typography',
			label: __('Question Typography', 'flo'),
		},
		answerTypography: {
			type: 'typography',
			label: __('Answer Typography', 'flo'),
		},
		counterNumberTypography: {
			type: 'typography',
			label: __('Counter Number Typography', 'flo'),
		},

		topMargin: {
			type: 'range',
			label: __('Desktop Top Margin Correction', 'flo'),
			min: -100,
			max: 100,
		},
		bottomMargin: {
			type: 'range',
			label: __('Desktop Bottom Margin Correction', 'flo'),
			min: -100,
			max: 100,
		},
		mobileTopMargin: {
			type: 'range',
			label: __('Mobile Top Margin Correction', 'flo'),
			min: -100,
			max: 100,
		},
		mobileBottomMargin: {
			type: 'range',
			label: __('Mobile Bottom Margin Correction', 'flo'),
			min: -100,
			max: 100,
		},
	},
	groups = [
		{
			name: __('General', 'flo'),
			fields: [
				'title',
				'titleTypography',
				//'titleDecorativeIcon',
				'list',
				'questionTypography',
				'answerTypography',
				'counterNumberTypography',
			],
			open: true,
		},
		{
			name: __('Margins', 'flo'),
			fields: [
				'topMargin',
				'bottomMargin',
				'mobileTopMargin',
				'mobileBottomMargin',
			],
			open: false,
		},
	];
