/// Helper for `o-brand` function.
/// @access private
@function _oFormsGet($variables, $from: null) {
	@return oBrandGet(
		$component: 'o-forms',
		$variables: $variables,
		$from: $from
	);
}

/// Helper for `o-brand` function.
/// @access private
@function _oFormsSupports($variant) {
	@return oBrandSupportsVariant($component: 'o-forms', $variant: $variant);
}

$_o-forms-shared-brand-config: (
	default-text: oPrivateFoundationGet('o3-color-use-case-body-text'),
	default-prompt-text: oPrivateFoundationGet('o3-color-use-case-body-text'),
	default-border: oPrivateFoundationGet('o3-color-palette-black-50'),
	default-background: oPrivateFoundationGet('o3-color-palette-white'),
	radio-background: transparent,
	disabled-text: oPrivateFoundationGet('o3-color-palette-black-60'),
	disabled-base: oPrivateFoundationGet('o3-color-palette-black-10'),
	controls-checked-base: oPrivateFoundationGet('o3-color-palette-white'),
	toggle: oPrivateFoundationGet('o3-color-palette-black'),
	toggle-knob:
		oPrivateColorsMix('o3-color-palette-black', 'o3-color-palette-white', 10),
	toggle-knob-selected: oPrivateFoundationGet('o3-color-palette-white'),
	toggle-disabled: oPrivateFoundationGet('o3-color-palette-black-20'),
	toggle-knob-disabled: oPrivateFoundationGet('o3-color-palette-black-40'),
	toggle-inverse: oPrivateFoundationGet('o3-color-palette-white'),
);

@if oBrandIs('core') or oBrandIs('internal') {
	$_o-forms-shared-brand-config: map-merge(
		$_o-forms-shared-brand-config,
		(
			toggle-selected: oPrivateFoundationGet('o3-color-palette-teal-50'),
			controls-base: oPrivateFoundationGet('o3-color-palette-teal-50'),
			controls-negative-checked-background:
				oPrivateFoundationGet('o3-color-palette-teal-30'),
			toggle-inverse-selected:
				oPrivateFoundationGet('o3-color-palette-teal-100'),
			invalid-base: oPrivateFoundationGet('o3-color-palette-crimson'),
			invalid-base-inverse: oPrivateFoundationGet('o3-color-palette-white'),
			invalid-base-color-inverse:
				oPrivateFoundationGet('o3-color-palette-black'),
			valid-base:
				oPrivateColorsMix(
					'o3-color-palette-jade',
					'o3-color-palette-black',
					80
				),
			toggle-inverse-knob: oPrivateFoundationGet('o3-color-palette-slate'),
		)
	) !global;
}

@if oBrandIs('core') {
	@include oBrandDefine(
		'o-forms',
		'core',
		(
			'variables':
				map-merge(
					$_o-forms-shared-brand-config,
					(
						invalid-base-border-inverse:
							oPrivateFoundationGet('o3-color-palette-claret-100'),
						error-summary-background-inverse:
							rgba(oPrivateFoundationGet('o3-color-palette-claret-100'), 0.11),
						error-summary-border-inverse:
							oPrivateFoundationGet('o3-color-palette-claret-100'),
						'professional': (
							default-text:
								oPrivateFoundationGet(
									'o3-color-use-case-body-text',
									'professional'
								),
							controls-base:
								oPrivateFoundationGet('o3-color-palette-slate', 'professional'),
							controls-negative-checked-background:
								oPrivateFoundationGet('o3-color-palette-slate', 'professional'),
							radio-background:
								oPrivateFoundationGet('o3-color-palette-slate', 'professional'),
							default-border:
								oPrivateFoundationGet(
									'o3-color-palette-black-50',
									'professional'
								),
							controls-checked-base:
								oPrivateFoundationGet('o3-color-palette-white', 'professional'),
						),
						'professional-inverse': (
							default-text:
								oPrivateFoundationGet(
									'o3-color-use-case-body-inverse-text',
									'professional'
								),
							radio-background:
								oPrivateFoundationGet('o3-color-palette-mint', 'professional'),
							default-border:
								oPrivateFoundationGet('o3-color-palette-mint', 'professional'),
							controls-base:
								oPrivateFoundationGet('o3-color-palette-mint', 'professional'),
							controls-checked-base:
								oPrivateFoundationGet('o3-color-palette-slate', 'professional'),
						),
						'ft-live': (
							default-text: oPrivateFoundationGet('o3-color-palette-white'),
							controls-base: oPrivateFoundationGet('o3-color-palette-ft-pink'),
							default-border: oPrivateFoundationGet('o3-color-palette-ft-pink'),
							controls-checked-base:
								oPrivateFoundationGet('o3-color-palette-slate'),
						),
					)
				),
			'supports-variants': (
				'professional',
				'professional-inverse',
				'ft-live',
			),
		)
	);
}

@if oBrandIs('internal') {
	@include oBrandDefine(
		'o-forms',
		'internal',
		(
			'variables':
				map-merge(
					$_o-forms-shared-brand-config,
					(
						invalid-base-border-inverse:
							oPrivateFoundationGet('o3-color-palette-crimson'),
						error-summary-background-inverse:
							rgba(oPrivateFoundationGet('o3-color-palette-crimson'), 0.11),
						error-summary-border-inverse:
							oPrivateFoundationGet('o3-color-palette-crimson'),
						radio-background: oPrivateFoundationGet('o3-color-palette-white'),
					)
				),
			'supports-variants': (),
		)
	);
}

@if oBrandIs('whitelabel') {
	@include oBrandDefine(
		'o-forms',
		'whitelabel',
		(
			'variables':
				map-merge(
					$_o-forms-shared-brand-config,
					(
						controls-base: oPrivateFoundationGet('o3-color-palette-black'),
						controls-negative-checked-background:
							oPrivateFoundationGet('o3-color-palette-black'),
						toggle-inverse-selected:
							oPrivateFoundationGet('o3-color-palette-white'),
						toggle-inverse-knob: oPrivateFoundationGet('o3-color-palette-black'),
						invalid-base: oPrivateFoundationGet('o3-color-palette-crimson'),
						invalid-base-inverse:
							oPrivateFoundationGet('o3-color-palette-white'),
						invalid-base-color-inverse:
							oPrivateFoundationGet('o3-color-palette-black'),
						invalid-base-border-inverse:
							oPrivateFoundationGet('o3-color-palette-crimson'),
						valid-base:
							oPrivateColorsMix(
								'o3-color-palette-jade',
								'o3-color-palette-black',
								80
							),
						error-summary-background-inverse:
							rgba(oPrivateFoundationGet('o3-color-palette-crimson'), 0.11),
						error-summary-border-inverse:
							oPrivateFoundationGet('o3-color-palette-crimson'),
					)
				),
			'supports-variants': (),
		)
	);
}
