import * as React from 'react'
import {__, _x} from '@wordpress/i18n'

import {
	type OptionsStrings,
	OptionsStringsContext,
} from '@ska/plugin'

import {
	type ImportExportStrings,
	ImportExportStringsContext,
} from '@ska/components'

const OPTIONS_STRINGS: OptionsStrings = {
	backButtonLabel: _x('Back', 'options', 'ska-blocks'),
	fullScreenLabel: _x('Full screen', 'options', 'ska-blocks'),
	resetToDefaultLabel: _x('Reset to default', 'options', 'ska-blocks'),
	resetToDefaultsLabel: _x('Reset to defaults', 'options', 'ska-blocks'),
	optionActionsLabel: _x('Option actions', 'options', 'ska-blocks'),
	inspectLabel: _x('Inspect', 'options', 'ska-blocks'),
	diffLabel: _x('Diff', 'options', 'ska-blocks'),
	viewDiffLabel: _x('Diff', 'options', 'ska-blocks'),
	diffOriginalValueLabel: _x('Original value', 'options', 'ska-blocks'),
	diffCurrentValueLabel: _x('Current value', 'options', 'ska-blocks'),
	restoreOptionsLabel: _x('Restore options', 'options', 'ska-blocks'),
	saveNotice: _x('Save to reset options.', 'options', 'ska-blocks'),
	errorNotice: _x('There was an error retrieving options.', 'options', 'ska-blocks'),
	showAdvancedLabel: _x('Show advanced options', 'options', 'ska-blocks'),
	showAdvancedDescription: _x(`You probably don't need to edit these.`, 'options', 'ska-blocks'),
}

const IMPORT_EXPORT_STRINGS: ImportExportStrings = {
	exportLabel: _x('Export', 'import/export', 'ska-blocks'),
	importLabel: _x('Import', 'import/export', 'ska-blocks'),
	importDemoLabel: _x('Import demo', 'import/export', 'ska-blocks'),
	importAllLabel: _x('Import all', 'import/export', 'ska-blocks'),
	importedLabel: _x('Imported', 'import/export', 'ska-blocks'),
	importExportLoadingLabel: _x('Loading…', 'import/export', 'ska-blocks'),
	downloadLabel: _x('Download', 'import/export', 'ska-blocks'),
	currentValueLabel: _x('Current value', 'import/export', 'ska-blocks'),
	importedValueLabel: _x('Imported value', 'import/export', 'ska-blocks'),
	invalidImportFileContentsMessage: _x('Invalid import file contents', 'import/export', 'ska-blocks'),
	nothingToImportMessage: _x('Nothing to import.', 'import/export', 'ska-blocks'),
	createLabel: _x('Create', 'import/export', 'ska-blocks'),
	createdLabel: _x('Created', 'import/export', 'ska-blocks'),
	overwriteLabel: _x('Overwrite current', 'import/export', 'ska-blocks'),
	createCopyLabel: _x('Create a copy', 'import/export', 'ska-blocks'),
	titleLabel: _x('Title', 'import/export', 'ska-blocks'),
	noTitleLabel: _x('(No title)', 'import/export', 'ska-blocks'),
	exportInstructions: _x(`Select all the content you wish to export and then press "Download" all the way at the bottom.`, 'import/export', 'ska-blocks'),
	importInstructions: _x(`Import the desired content, then close this modal and save changes.`, 'import/export', 'ska-blocks'),
	isSameText: _x(`Imported value is identical to current value.`, 'import/export', 'ska-blocks'),
	labelDefault: _x(`Default`, 'import/export', 'ska-blocks'),
	labelModified: _x(`Modified`, 'import/export', 'ska-blocks'),
	labelCustom: _x(`Custom`, 'import/export', 'ska-blocks'),
	labelFrontPage: _x(`Front page`, 'import/export', 'ska-blocks'),
	labelBlogPage: _x(`Blog page`, 'import/export', 'ska-blocks'),
	createMissingEntitiesLabel: _x(`Create missing entities`, 'import/export', 'ska-blocks'),
	createMissingEntitiesDescription: _x(`Create posts, pages and other entities included in this import. Uncheck to only update option values and overwrite existing templates, but not create any new posts, pages or templates.`, 'import/export', 'ska-blocks'),
	summaryLabel: _x(`The following resources will be imported:`, 'import/export', 'ska-blocks'),
}

const OptionsStringsProvider: React.FC<{children: React.ReactNode}> = ({children}) => {
	return (
		<OptionsStringsContext.Provider value={OPTIONS_STRINGS}>
			<ImportExportStringsContext.Provider value={IMPORT_EXPORT_STRINGS}>
				{children}
			</ImportExportStringsContext.Provider>
		</OptionsStringsContext.Provider>
	)
}

export default OptionsStringsProvider
