<?php

/*
 * This file is part of the AuthStack project.
 *
 * (c) Buckhill Ltd <development@buckhill.co.uk>
 *
 * This source file is subject to the Buckhill license that is bundled
 * with this source code in the file LICENSE.
 */

namespace AuthStack\TwoFactor\Model;

use Illuminate\Database\Eloquent\Model;

class MFAMode extends Model
{
    const MODE_RFC4226 = 1;
    const MODE_RFC6238 = 2;
    const MODE_YUBIKEY = 3;
    const MODE_YUBIKEY_OATH = 4;
    const MODE_U2F = 5;

    protected $guarded = ['*'];
    protected $table = 'mfa_mode';
    protected $casts = [
        'config' => 'array'
    ];

    public function setConfigAttribute($value)
    {
        $this->attributes['config'] = json_encode($value);
    }
}