<?php

namespace LaraBB\Profile\Tasks;

use LaraBB\Profile\Models\Profile;

/**
 * Class StoreProfileTask
 * @package LaraBB\Profile\Tasks
 */
class StoreTask
{
    /**
     * StoreProfileTask constructor.
     * @param Profile $profile
     */
    public function __construct(private readonly Profile $profile)
    {
    }

    /**
     * @param array $data
     * @return bool
     */
    public function run(array $data = []): bool
    {
        $this->profile->user_uuid    = $data['user_uuid'];
        $this->profile->created_uuid = $data['created_uuid'];
        $this->profile->updated_uuid = $data['updated_uuid'];

        return $this->profile->save();
    }
}
