<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Prevent direct access to the script.
}


$profile_id = $args['profile_id'] ?? gigneo_active_profile_id();

if ( ! in_array( 'deactivate_account', gigneo_active_modules(), true ) ) {
	return;
}

$deactivation_reasons = gigneo_option( '_gigneo_ts_deactivate_account_reasons' );
?>
<div class="gn-info-inline">
	<div class="gn-info">
		<h4 class="gn-title"><?php echo esc_html__( 'Deactivate account', 'gigneo' ); ?></h4>
		<p class="gn-description"><?php echo esc_html__( 'Hibernating your profile deactivate account temporarily.', 'gigneo' ); ?></p>
	</div>
	<div class="gn-actions">
		<button class="gn-btn gn-btn-toggle-icon" data-gn-modal-toggle="gn-account-deactivation">
			<i class="hi hi-arrow-up-right" aria-hidden="true"></i>
		</button>
	</div>
	<!--Account Deactivation Modal-->
	<div id="gn-account-deactivation" class="gn-modal-wrapper gn-user-setting-modal gn-account-deactivation">
		<div class="gn-modal-dialog">
			<div class="gn-modal-content">
				<div class="gn-modal-info">
					<div class="gn-modal-header">
						<h4 class="gn-title"><?php echo esc_html__( 'Deactivate account', 'gigneo' ); ?></h4>
						<p class="gn-description"><?php echo esc_html__( 'Hibernating your profile deactivate account temporarily.', 'gigneo' ); ?></p>
						<button type="button" data-gn-modal-close="gn-account-deactivation" class="gn-modal-close">
							<i class="hi hi-x-mark" aria-hidden="true"></i>
						</button>
					</div>
					<form id="gn-save-account-setting-form" class="gn-theme-form gn-save-user-account-setting">
						<div class="gn-modal-body gn-custom-scrollbar">
							<div class="gn-notices-wrapper">
								<div class="gn-notice gn-notice-info">
									<div class="gn-info">
										<h3 class="gn-title"><?php echo esc_html__( 'This will:', 'gigneo' ); ?></h3>
										<ul class="gn-info-list">
											<li><?php echo esc_html__( 'Disable your access to the platform.', 'gigneo' ); ?></li>
											<li><?php echo esc_html__( 'Hide your profile from clients and searches', 'gigneo' ); ?></li>
											<li><?php echo esc_html__( 'Pause all your active services and hide from searches.', 'gigneo' ); ?></li>
										</ul>
									</div>
								</div>
							</div>
							<fieldset class="gn-form-fields">
								<div class="row g-4">
									<div class="col-md-12">
										<div class="gn-form-field">
											<h4 class="gn-section-title gn-required-field-label"><?php echo esc_html__( 'We’d appreciate your feedback before you deactivate.', 'gigneo' ); ?></h4>
											<?php
											foreach ( $deactivation_reasons as $key => $deactivation_reason ) {
												if ( empty( $deactivation_reason['reason'] ) ) {
													continue;
												}
												?>
												<div class="gn-radio">
													<input type="radio" name="deactivation_reason" id="gn-deactivation-reason-<?php echo esc_attr( $key ); ?>" value="<?php echo esc_attr( $deactivation_reason['reason'] ); ?>" <?php echo esc_attr( 0 === $key ? ' checked="checked"' : '' ); ?> />
													<label for="gn-deactivation-reason-<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $deactivation_reason['reason'] ); ?></label>
												</div>
											<?php } ?>
										</div>
									</div>
									<div class="col-md-12">
										<div class="gn-form-field">
											<label class="gn-section-title gn-alt-font gn-required-field-label" for="gn-deactivation-detail"><?php echo esc_html__( 'Tell us more', 'gigneo' ); ?></label>
											<textarea id="gn-deactivation-detail" class="gn-required-field gn-textarea-counter" name="deactivation_detail" autocomplete="off" rows="5" placeholder="<?php echo esc_attr__( 'Write detail here...', 'gigneo' ); ?>"></textarea>
										</div>
									</div>
								</div>
							</fieldset>
						</div>
						<div class="gn-modal-footer">
							<input type="hidden" name="type" value="deactivate_account">
							<button type="button" class="gn-btn gn-btn-outline-grey" data-gn-modal-close="gn-account-deactivation"><?php echo esc_html__( 'Close', 'gigneo' ); ?></button>
							<button type="submit" class="gn-btn gn-btn-primary"><?php echo esc_html__( 'Deactivate', 'gigneo' ); ?></button>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>