<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class MemberProfile extends Model
{
    protected $fillable = [
        'user_id',
        'unit_id',
        'district_id',
        'state_id',
        'plan_id',
        'membership_type',
        'membership_id',
        'status',
        'dob',
        'gender',
        'photo',
        'address',
        'pincode',
        'organization',
        'designation',
        'experience',
        'website',
        'joined_date',
        'expiry_date',
    ];

    // ─────────────────────────────────
    // RELATIONSHIPS
    // ─────────────────────────────────

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

    public function unit()
    {
        return $this->belongsTo(Unit::class, 'unit_id');
    }

    public function district()
    {
        return $this->belongsTo(District::class, 'district_id');
    }

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

    // ── ADD THIS ──
    public function plan()
    {
        return $this->belongsTo(
            MembershipPlan::class, 'plan_id'
        );
    }
}