<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Zone extends Model
{
    protected $fillable = [
        'name', 'state_id', 'zone_type', 'far_fsi', 'max_height_m', 'max_ground_coverage',
        'front_setback_m', 'side_setback_m', 'rear_setback_m', 'open_space_pct',
        'permitted_uses', 'notes', 'description', 'regulation_ref', 'is_active',
    ];

    protected $casts = [
        'is_active' => 'boolean',
        'far_fsi' => 'float',
        'max_height_m' => 'float',
        'max_ground_coverage' => 'float',
        'front_setback_m' => 'float',
        'side_setback_m' => 'float',
        'rear_setback_m' => 'float',
        'open_space_pct' => 'float',
    ];

    public function state()
    {
        return $this->belongsTo(State::class);
    }

    public function zoneRules()
    {
        return $this->hasMany(ZoneRule::class);
    }

    public function feasibilityReports()
    {
        return $this->hasMany(FeasibilityReport::class);
    }
}
