<?php

namespace App\Models;


use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\SoftDeletes;

class Collaborator extends BaseModel
{
    use SoftDeletes;
    protected $table = 'collaborator';

    const TYPE_USER = 0;
    const TYPE_PART_TIME = 1;
    const TYPE_FULL_TIME = 2;

    const STATUS_PREVIEW = 0;
    const STATUS_PASS = 1;
    const STATUS_REJECT = 2;
    protected function specialty(): Attribute
    {
        return Attribute::make(
            get: fn ($value) => json_decode($value,true),
            set: fn ($value) => json_encode($value),
        );
    }

    protected function bio(): Attribute
    {
        return Attribute::make(
            get: fn ($value) => json_decode($value,true),
            set: fn ($value) => json_encode($value),
        );
    }

    protected function protocols(): Attribute
    {
        return Attribute::make(
            get: fn ($value) => json_decode($value,true),
            set: fn ($value) => json_encode($value),
        );
    }

    protected function diploma(): Attribute
    {
        return Attribute::make(
            get: fn ($value) => json_decode($value,true),
            set: fn ($value) => json_encode($value),
        );
    }
}