import { __ } from '@wordpress/i18n';
import { PanelBody, ButtonGroup, Button } from '@wordpress/components';
import AlignStart from '../icons/AlignStart';
import AlignCenter from '../icons/AlignCenter';
import AlignBottom from '../icons/AlignBottom';
import AlignStretch from '../icons/AlignStretch';
import AlignBaseline from '../icons/AlignBaseline';
import JustifyStart from '../icons/JustifyStart';
import JustifyCenter from '../icons/JustifyCenter';
import JustifyEnd from '../icons/JustifyEnd';
import JustifyBetween from '../icons/JustifyBetween';
import JustifyAround from '../icons/JustifyAround';
import ResponsiveInheritedNotice from '../../controls/ResponsiveInheritedNotice';

export default function AlignmentHover({ activeDevice, alignItems__hover, justifyContent__hover, justifyItems__hover, justifySelf__hover, alignSelf__hover, updateDeviceAttribute, }) {
	const alignItemsOptions = [
		{ value: 'start', label: __('Start', 'axcelersblocks') },
		{ value: 'center', label: __('Center', 'axcelersblocks') },
		{ value: 'end', label: __('End', 'axcelersblocks') },
		{ value: 'stretch', label: __('Stretch', 'axcelersblocks') },
		{ value: 'baseline', label: __('Baseline', 'axcelersblocks') },
	];
	const justifyContentOptions = [
		{ value: 'start', label: __('Start', 'axcelersblocks') },
		{ value: 'center', label: __('Center', 'axcelersblocks') },
		{ value: 'end', label: __('End', 'axcelersblocks') },
		{ value: 'space-between', label: __('Space Between', 'axcelersblocks') },
		{ value: 'space-around', label: __('Space Around', 'axcelersblocks') },
	];
	const selfAlignmentOptions = [
		{ value: 'start', label: __('Start', 'axcelersblocks') },
		{ value: 'center', label: __('Center', 'axcelersblocks') },
		{ value: 'end', label: __('End', 'axcelersblocks') },
		{ value: 'stretch', label: __('Stretch', 'axcelersblocks') },
	];
  const handleAlignItemsChange = (value) => {
    updateDeviceAttribute('alignItems__hover', value);
  };

  const handleJustifyContentChange = (value) => {
    updateDeviceAttribute('justifyContent__hover', value);
  };

  const handleJustifyItemsChange = (value) => {
    updateDeviceAttribute('justifyItems__hover', value);
  };

  const handleJustifySelfChange = (value) => {
    updateDeviceAttribute('justifySelf__hover', value);
  };

  const handleAlignSelfChange = (value) => {
    updateDeviceAttribute('alignSelf__hover', value);
  };

  return (
    <PanelBody
			className='alignment-control'
      title={__('Alignment (Hover)', 'axcelersblocks')}
      initialOpen={false}
    >
      <div className="axcelersblocks-alignment-control align-items">
        <label>{__('Align Items', 'axcelersblocks')}</label>
        <ButtonGroup>
          <Button
						icon={<AlignStart />}
            isPressed={alignItems__hover[activeDevice] === 'start'}
            onClick={() => handleAlignItemsChange('start')}
            label={__('Start', 'axcelersblocks')}
          />
          <Button
						icon={<AlignCenter />}
            isPressed={alignItems__hover[activeDevice] === 'center'}
            onClick={() => handleAlignItemsChange('center')}
            label={__('Center', 'axcelersblocks')}
          />
          <Button
						icon={<AlignBottom />}
            isPressed={alignItems__hover[activeDevice] === 'end'}
            onClick={() => handleAlignItemsChange('end')}
            label={__('End', 'axcelersblocks')}
          />
          <Button
						icon={<AlignStretch />}
            isPressed={alignItems__hover[activeDevice] === 'stretch'}
            onClick={() => handleAlignItemsChange('stretch')}
            label={__('Strech', 'axcelersblocks')}
          />
					<Button
						icon={<AlignBaseline />}
            isPressed={alignItems__hover[activeDevice] === 'baseline'}
            onClick={() => handleAlignItemsChange('baseline')}
            label={__('Baseline', 'axcelersblocks')}
          />
          <Button
						className='reset-btn'
            isPressed={alignItems__hover[activeDevice] === ''}
            onClick={() => handleAlignItemsChange('')}
            label={__('Reset', 'axcelersblocks')}
          >
            {__('Reset', 'axcelersblocks')}
          </Button>
        </ButtonGroup>
				<ResponsiveInheritedNotice
					values={ alignItems__hover }
					activeDevice={ activeDevice }
					options={ alignItemsOptions }
				/>
      </div>

      <div className="axcelersblocks-alignment-control justify-content">
        <label>{__('Justify Content', 'axcelersblocks')}</label>
        <ButtonGroup>
          <Button
						icon={<JustifyStart />}
            isPressed={justifyContent__hover[activeDevice] === 'start'}
            onClick={() => handleJustifyContentChange('start')}
            label={__('Start', 'axcelersblocks')}
          />
          <Button
						icon={<JustifyCenter />}
            isPressed={justifyContent__hover[activeDevice] === 'center'}
            onClick={() => handleJustifyContentChange('center')}
            label={__('Center', 'axcelersblocks')}
          />
          <Button
						icon={<JustifyEnd />}
            isPressed={justifyContent__hover[activeDevice] === 'end'}
            onClick={() => handleJustifyContentChange('end')}
            label={__('End', 'axcelersblocks')}
          />
          <Button
						icon={<JustifyBetween />}
            isPressed={justifyContent__hover[activeDevice] === 'space-between'}
            onClick={() => handleJustifyContentChange('space-between')}
            label={__('Space Between', 'axcelersblocks')}
          />
          <Button
						icon={<JustifyAround />}
            isPressed={justifyContent__hover[activeDevice] === 'space-around'}
            onClick={() => handleJustifyContentChange('space-around')}
            label={__('Space Around', 'axcelersblocks')}
          />
          <Button
						className='reset-btn'
            isPressed={justifyContent__hover[activeDevice] === ''}
            onClick={() => handleJustifyContentChange('')}
            label={__('Reset', 'axcelersblocks')}
          >
            {__('Reset', 'axcelersblocks')}
          </Button>
        </ButtonGroup>
				<ResponsiveInheritedNotice
					values={ justifyContent__hover }
					activeDevice={ activeDevice }
					options={ justifyContentOptions }
				/>
      </div>

      <div className="axcelersblocks-alignment-control justify-items">
        <label>{__('Justify Items', 'axcelersblocks')}</label>
        <ButtonGroup>
          <Button
            isPressed={justifyItems__hover[activeDevice] === 'start'}
            onClick={() => handleJustifyItemsChange('start')}
            label={__('Start', 'axcelersblocks')}
          >
						{__('Start', 'axcelersblocks')}
          </Button>
          <Button
            isPressed={justifyItems__hover[activeDevice] === 'center'}
            onClick={() => handleJustifyItemsChange('center')}
            label={__('Center', 'axcelersblocks')}
          >
						{__('Center', 'axcelersblocks')}
          </Button>
          <Button
            isPressed={justifyItems__hover[activeDevice] === 'end'}
            onClick={() => handleJustifyItemsChange('end')}
            label={__('End', 'axcelersblocks')}
          >
						{__('End', 'axcelersblocks')}
					</Button>
          <Button
            isPressed={justifyItems__hover[activeDevice] === 'stretch'}
            onClick={() => handleJustifyItemsChange('stretch')}
            label={__('Stretch', 'axcelersblocks')}
          >
						{__('Stretch', 'axcelersblocks')}
					</Button>
          <Button
						className='reset-btn'
            isPressed={justifyItems__hover[activeDevice] === ''}
            onClick={() => handleJustifyItemsChange('')}
            label={__('Reset', 'axcelersblocks')}
          >
            {__('Reset', 'axcelersblocks')}
          </Button>
        </ButtonGroup>
				<ResponsiveInheritedNotice
					values={ justifyItems__hover }
					activeDevice={ activeDevice }
					options={ selfAlignmentOptions }
				/>
      </div>

      <div className="axcelersblocks-alignment-control justify-self">
        <label>{__('Justify Self', 'axcelersblocks')}</label>
        <ButtonGroup>
          <Button
            isPressed={justifySelf__hover[activeDevice] === 'start'}
            onClick={() => handleJustifySelfChange('start')}
            label={__('Start', 'axcelersblocks')}
          >
            {__('Start', 'axcelersblocks')}
					</Button>
          <Button
            isPressed={justifySelf__hover[activeDevice] === 'center'}
            onClick={() => handleJustifySelfChange('center')}
            label={__('Center', 'axcelersblocks')}
          >
						{__('Center', 'axcelersblocks')}
					</Button>
          <Button
            isPressed={justifySelf__hover[activeDevice] === 'end'}
            onClick={() => handleJustifySelfChange('end')}
            label={__('End', 'axcelersblocks')}
          >
						{__('End', 'axcelersblocks')}
					</Button>
          <Button
            isPressed={justifySelf__hover[activeDevice] === 'stretch'}
            onClick={() => handleJustifySelfChange('stretch')}
            label={__('Stretch', 'axcelersblocks')}
          >
						{__('Stretch', 'axcelersblocks')}
					</Button>
          <Button
						className='reset-btn'
            isPressed={justifySelf__hover[activeDevice] === ''}
            onClick={() => handleJustifySelfChange('')}
            label={__('Reset', 'axcelersblocks')}
          >
            {__('Reset', 'axcelersblocks')}
          </Button>
        </ButtonGroup>
				<ResponsiveInheritedNotice
					values={ justifySelf__hover }
					activeDevice={ activeDevice }
					options={ selfAlignmentOptions }
				/>
      </div>

      <div className="axcelersblocks-alignment-control align-self">
        <label>{__('Align Self', 'axcelersblocks')}</label>
        <ButtonGroup>
          <Button
            isPressed={alignSelf__hover[activeDevice] === 'start'}
            onClick={() => handleAlignSelfChange('start')}
            label={__('Start', 'axcelersblocks')}
          >
            {__('Start', 'axcelersblocks')}
					</Button>
          <Button
            isPressed={alignSelf__hover[activeDevice] === 'center'}
            onClick={() => handleAlignSelfChange('center')}
            label={__('Center', 'axcelersblocks')}
          >
						{__('Center', 'axcelersblocks')}
					</Button>
          <Button
            isPressed={alignSelf__hover[activeDevice] === 'end'}
            onClick={() => handleAlignSelfChange('end')}
            label={__('End', 'axcelersblocks')}
          >
						{__('End', 'axcelersblocks')}
					</Button>
          <Button
            isPressed={alignSelf__hover[activeDevice] === 'stretch'}
            onClick={() => handleAlignSelfChange('stretch')}
            label={__('Stretch', 'axcelersblocks')}
          >
						{__('Stretch', 'axcelersblocks')}
					</Button>
          <Button
						className='reset-btn'
            isPressed={alignSelf__hover[activeDevice] === ''}
            onClick={() => handleAlignSelfChange('')}
            label={__('Reset', 'axcelersblocks')}
          >
            {__('Reset', 'axcelersblocks')}
          </Button>
        </ButtonGroup>
				<ResponsiveInheritedNotice
					values={ alignSelf__hover }
					activeDevice={ activeDevice }
					options={ selfAlignmentOptions }
				/>
      </div>
    </PanelBody>
  );
}
