<?php

namespace App\Models;

use App\Models\Concerns\NormalizesEmails;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;

class Promoter extends Model
{
    use NormalizesEmails;

    protected $fillable = [
        'user_id',
        'applicant_name',
        'designation',
        'building',
        'street',
        'city',
        'state',
        'postal_code',
        'country',
        'email',
        'phone',
        'photo_path',
        'id_proof_path',
        'institute_name',
        'firm_type',
        'official_building',
        'official_street',
        'official_city',
        'official_state',
        'official_postal_code',
        'official_country',
        'official_email',
        'official_phone',
        'operational_area',
        'experience',
        'second_contact_name',
        'second_contact_email',
        'second_contact_phone',
    ];

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

    public function superAdmins(): BelongsToMany
    {
        return $this->belongsToMany(User::class, 'promoter_user');
    }

    public function authorisedPartners(): HasMany
    {
        return $this->hasMany(AuthorisedPartner::class);
    }
}
