<?php

namespace ModulesGarden\HostingQuotaNotifications\App\Helper\Migration\Groups;

use ModulesGarden\HostingQuotaNotifications\App\Models\Groups as GroupModel;
/**
 * Class Group
 *
 * @author Artur Pilch <artur.pi@modulesgarden.com>
 */
class Group
{
    public static function migrateGroupAndReturnGroupId($oldGroup, $emailTemplate)
    {
        $group = new GroupModel();
        $group->name   = $oldGroup->name;
        $group->type   = $oldGroup->type;
        $group->status = $oldGroup->disabled == 0 ? 'on' : 'off';
        $group->defaultEmailTemplate = $emailTemplate;
        $group->save();
        return $group->id;
    }
}