// Dependancies
@import '@financial-times/math';
@import '@financial-times/o-brand/main';
@import '@financial-times/o-private-foundation/main';

// Branding
@import 'src/scss/brand';
// Main
@import 'src/scss/variables';
@import 'src/scss/base';
@import 'src/scss/borders';
@import 'src/scss/compact';
@import 'src/scss/container';
@import 'src/scss/lines';
@import 'src/scss/responsive-overflow';
@import 'src/scss/responsive-flat';
@import 'src/scss/responsive-scroll';
@import 'src/scss/row-headings';
@import 'src/scss/row-stripes';
@import 'src/scss/sort';
@import 'src/scss/wrapper';

/// Outputs all features and styles available.
/// @param {list} $opts [('responsive-overflow', 'responsive-flat', 'responsive-scroll', 'lines', 'compact', 'stripes', 'row-headings')] - Table features to output. Defaults to all table features.
/// @access public
@mixin oTable(
	$opts: (
		'responsive-overflow',
		'responsive-flat',
		'responsive-scroll',
		'lines',
		'compact',
		'stripes',
		'row-headings',
	)
) {
	@include oPrivateFoundation();

	$overflow-enabled: index($opts, 'responsive-overflow');
	$flat-enabled: index($opts, 'responsive-flat');
	$scroll-enabled: index($opts, 'responsive-scroll');
	$lines-enabled: index($opts, 'lines');
	$compact-enabled: index($opts, 'compact');
	$stripes-enabled: index($opts, 'stripes');
	$row-headings-enabled: index($opts, 'row-headings');

	// Basic styles and simple utilities.
	@include _oTableBase;

	// Sortable columns.
	@include _oTableSort;

	// Respnsive solutions.
	@if $flat-enabled or $scroll-enabled or $overflow-enabled {
		@include _oTableWrapper;
		@include _oTableContainer($expandable: $overflow-enabled);
	}
	@if $overflow-enabled {
		@include _oTableResponsiveOverflow;
	}
	@if $flat-enabled {
		@include _oTableResponsiveFlat;
	}
	@if $scroll-enabled {
		@include _oTableResponsiveScroll;
	}

	// Lines.
	@if $lines-enabled {
		@include _oTableHorizontalLines;
		@include _oTableVerticalLines;
		@include _oTableHorizontalBorders;
		@include _oTableVerticalBorders;
	}

	// Compact.
	@if $compact-enabled and _oTableSupports('compact') {
		@include _oTableCompact;
	}

	// Stripes.
	@if $stripes-enabled and _oTableSupports('stripes') {
		@include _oTableRowStripes;
	}

	// Row headings.
	@if $row-headings-enabled and _oTableSupports('row-headings') {
		@include _oTableRowHeadings;
	}
}

@if ($o-table-is-silent == false) {
	@include oTable();

	// Set table to silent again to avoid being output twice
	$o-table-is-silent: true !global;
}
