<?php

declare(strict_types=1);

namespace App\Models\Market;

use App\Models\Model;
use App\Models\User;

class FarmerProfile extends Model
{
    protected ?string $table = 'farmer_profiles';

    protected array $fillable = [
        'hashkey',
        'user_id',
        'organization_id',
        'farm_name',
        'farm_location',
        'main_crops',
        'verification_status',
        'certification_details',
        'is_active',
        'created_by',
        'updated_by',
    ];

    protected array $casts = [
        'main_crops' => 'array',
        'certification_details' => 'array',
        'is_active' => 'boolean',
    ];

    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    public function organization()
    {
        return $this->belongsTo(Organization::class, 'organization_id');
    }

    public function creator()
    {
        return $this->belongsTo(User::class, 'created_by');
    }

    public function updater()
    {
        return $this->belongsTo(User::class, 'updated_by');
    }
}
