<?php
/**
 * Author: Rymera Web Co.
 *
 * @package SAAI\Templates\Admin
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

$attachment_id = $args['attachment_id'] ?? 0;

if ( ! $attachment_id ) {
    return;
}

$attachment = get_post( $attachment_id );

if ( ! $attachment || 'attachment' !== $attachment->post_type || ! wp_attachment_is_image( $attachment ) ) {
    return;
}

?>
<div class="misc-pub-section saai-image-alt-tags-section">
    <button type="button" class="button button-secondary saai-generate-alt-tags-button" data-attachment-id="<?php echo esc_attr( $attachment_id ); ?>">
        <?php esc_html_e( 'Generate with AI', 'storeagent-ai-for-woocommerce' ); ?>
    </button>
    <span class="saai-alt-tags-status" style="display: none;"></span>
</div>

<style>
.saai-image-alt-tags-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.saai-generate-alt-tags-button {
    font-size: 12px;
    padding: 6px 12px;
}

.saai-alt-tags-status {
    font-size: 11px;
    color: #666;
    margin-left: 8px;
}

.saai-alt-tags-status.success {
    color: #46b450;
}

.saai-alt-tags-status.error {
    color: #dc3232;
}
</style>
