<?php

namespace App;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Photo2 extends Model
{
    use HasFactory;

    protected $table = 'photos';

    protected $fillable = [
        'id',
        'code',
        'status',
        'author',
        'category',
        'aws_path',
        'aws_rs_path',
        'file_url',
        'file_origin',
        'file_convert',
        'file_color',
        'file_mix',
        'file_result',
        'file_level',
        'assigned_id',
        'user_id',
        'rs_status', // 0:not found, 1: has image, 2: converted, 3: colored, 4: mixed, 5: done, 6: error
        'created_at',
        'updated_at'
    ];

    public function assigned() {
        return $this->belongsTo(User::class, 'assigned_id', 'id')->select('id', 'name', 'phone_number', 'email');
    }
}
