<?php
/**
 * MTC — Camera detail (expandable row)
 *
 * Renders the expandable detail panel for a camera in the dashboard table.
 * Each section is in its own partial under detail/ for maintainability.
 *
 * @package My Trail Camera
 * @since 8.1.0
 */

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

function mtcam_render_camera_details($cam_id, $cam, $days_in_field, $detection_count, $battery_cached = null, $context = array()) {
    $mtc_cam_id        = $cam_id;
    $mtc_cam           = $cam;
    $mtc_days_in_field = $days_in_field;
    $mtc_detection_count = $detection_count;
    $mtc_battery_cached  = $battery_cached;
    $mtc_extras = array();
    $mtc_all_cameras   = isset( $context['cameras'] ) ? $context['cameras'] : array();
    ?>
    <tr id="details-<?php echo esc_attr($mtc_cam_id); ?>" class="mtcam-details-row" style="display:none;">
        <td colspan="8">
            <div class="mtcam-info-grid">
                <?php
                include __DIR__ . '/detail/basic-info.php';
                include __DIR__ . '/detail/camera-profile.php';
                include __DIR__ . '/detail/dates-stats.php';
                include __DIR__ . '/detail/security-gps.php';

                if ($mtc_battery_cached !== null && mtcam_is_active($mtc_cam) && empty($mtc_cam['stolen_date'])) {
                    include __DIR__ . '/detail/battery-solar.php';
                }

                mtcam_render_detail_actions( $mtc_cam_id, $mtc_cam, $mtc_days_in_field, $mtc_extras, $mtc_all_cameras );
                ?>
            </div>
        </td>
    </tr>
    <?php
}
