<?php

namespace LaraBB\Profile\Tasks;

use LaraBB\Profile\Models\Profile;

class UpdateTask
{
    /**
     * @param Profile $profile
     * @param array $data
     * @return bool
     */
    public function run(Profile $profile, array $data = []): bool
    {
        $profile->uploaded   = $data['uploaded'] ?? $profile->uploaded;
        $profile->downloaded = $data['downloaded'] ?? $profile->downloaded;
        $profile->ratio      = $data['ratio'] ?? $profile->ratio;

        return $profile->save();
    }
}
