<?php

namespace LaraBB\Group\Tasks;

use LaraBB\Group\Models\Group;

/**
 * Class StoreGroupTask
 * @package LaraBB\Group\Tasks
 */
class StoreTask
{
    /**
     * StoreGroupTask constructor.
     * @param Group $group
     */
    public function __construct(private readonly Group $group)
    {

    }

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

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