<?php
defined( 'ABSPATH' ) || exit;
?>
<div class="cwpm-trash-view__topbar">

	<h4 class="cwpm-trash-view__title">
		<span class="icon icon--xs" aria-hidden="true"><i class="fa-solid fa-trash-can"></i></span>
		<?php esc_html_e( 'Trash', 'coffeewp-media-cleanup' ); ?>
	</h4>
	<button type="button" id="cwpm-trash-empty" class="btn btn--ghost  btn--no-shadow text-red"
		title="<?php esc_attr_e( 'Permanently delete all files in trash', 'coffeewp-media-cleanup' ); ?>">
		<i class="fa-solid fa-trash" aria-hidden="true"></i>
		<?php esc_html_e( 'Empty Trash', 'coffeewp-media-cleanup' ); ?>
	</button>
</div>

<div class="cwpm-stats-grid cwpm-trash-view__stats">
	<div class="cwpm-stat-card">
		<span class="cwpm-stat-card__icon icon text-warning" aria-hidden="true"><i
				class="fa-solid fa-file-image"></i></span>
		<div class="cwpm-stat-card__body">
			<span class="cwpm-stat-card__value" id="cwpm-trash-count">—</span>
			<span class="cwpm-stat-card__label"><?php esc_html_e( 'Files in Trash', 'coffeewp-media-cleanup' ); ?></span>
		</div>
	</div>
	<div class="cwpm-stat-card">
		<span class="cwpm-stat-card__icon icon" aria-hidden="true"><i class="fa-solid fa-hard-drive"></i></span>
		<div class="cwpm-stat-card__body">
			<span class="cwpm-stat-card__value" id="cwpm-trash-size">—</span>
			<span class="cwpm-stat-card__label"><?php esc_html_e( 'Total Size', 'coffeewp-media-cleanup' ); ?></span>
		</div>
	</div>
</div>

<div class="cwpm-trash-view__auto-delete">
	<label class="switch"
		title="<?php esc_attr_e( 'Automatically delete trashed files older than 30 days', 'coffeewp-media-cleanup' ); ?>">
		<input type="checkbox" class="switch__input" id="cwpm-trash-auto-delete" name="trash_auto_delete" value="1" <?php checked( (int) get_option( 'cwpm_trash_retention_days', 0 ) > 0 ); ?> />
		<span class="switch__track" aria-hidden="true"></span>
	</label>
	<span
		class="cwpm-trash-view__auto-delete-label"><?php esc_html_e( 'Auto-delete after 30 days', 'coffeewp-media-cleanup' ); ?></span>
</div>

<div id="cwpm-trash-empty-state" class="cwpm-trash-view__empty-state" style="display: none;">
	<span class="icon icon--xl text-success" aria-hidden="true"><i class="fa-solid fa-circle-check"></i></span>
	<p><?php esc_html_e( 'Your trash is empty.', 'coffeewp-media-cleanup' ); ?></p>
</div>

<?php
$cwpm_bar_config = array(
	'id_prefix'         => 'cwpm-trash',
	'search'            => true,
	'status_filter'     => false,
	'actions_button'    => true,
	'primary_cta'       => true,
	'primary_cta_label' => __( 'Run Actions', 'coffeewp-media-cleanup' ),
	'primary_cta_id'    => 'cwpm-trash-run-actions',
	'primary_cta_class' => 'btn--primary',
	'primary_cta_icon'  => 'fa-play',
	'primary_cta_title' => __( 'Run selected actions on checked files', 'coffeewp-media-cleanup' ),
	'compact_toggle'    => false,
	'group_toggle'      => false,
	'pagination'        => true,
	'select_visible'    => false,
	'select_all'        => true,
	'clean_progress'    => true,
);
require CWPM_PATH . 'templates/partials/action-bar.php';
?>

<div class="cwpm-table-scroll">
	<table class="table table--heading-secondary cwpm-file-table" id="cwpm-trash-table">
		<thead>
			<tr>
				<th class="th-select"><!-- Select checkbox column --></th>
				<th class="th-file"><?php esc_html_e( 'File', 'coffeewp-media-cleanup' ); ?></th>
				<th><?php esc_html_e( 'Size', 'coffeewp-media-cleanup' ); ?></th>
				<th><?php esc_html_e( 'Trashed', 'coffeewp-media-cleanup' ); ?></th>
				<th class="th-action"><!-- Action column --></th>
			</tr>
		</thead>
		<tbody id="cwpm-trash-tbody"></tbody>
	</table>
</div>
