<?php

namespace App\Http\Controllers\Api\V1\Admin\Jackpot\Concerns;

use App\Models\JackpotPoolAdjustment;

trait PresentsJackpotPoolAdjustment
{
    /** @return array<string, mixed> */
    private function adjustmentRow(JackpotPoolAdjustment $row): array
    {
        return [
            'id' => (int) $row->id,
            'adjustment_no' => $row->adjustment_no,
            'jackpot_pool_id' => (int) $row->jackpot_pool_id,
            'admin_user_id' => (int) $row->admin_user_id,
            'admin_username' => $row->adminUser?->username,
            'amount_delta' => (int) $row->amount_delta,
            'balance_before' => (int) $row->balance_before,
            'balance_after' => (int) $row->balance_after,
            'reason' => $row->reason,
            'created_at' => $row->created_at?->toIso8601String(),
        ];
    }
}
