<?php

namespace App\Models;

// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
    /** @use HasFactory<\Database\Factories\UserFactory> */
    use HasFactory, Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var list<string>
     */
    protected $fillable = [
        'name',
        'email',
        'password',
    ];

    /**
     * The attributes that should be hidden for serialization.
     *
     * @var list<string>
     */
    protected $hidden = [
        'password',
        'remember_token',
    ];

    /**
     * Get the attributes that should be cast.
     *
     * @return array<string, string>
     */
    protected function casts(): array
    {
        return [
            'email_verified_at' => 'datetime',
            'password' => 'hashed',
        ];
    }

    /**
     * Languages created by this user
     */
    public function createdLanguages()
    {
        return $this->hasMany(Language::class, 'created_by');
    }

    /**
     * Languages updated by this user
     */
    public function updatedLanguages()
    {
        return $this->hasMany(Language::class, 'updated_by');
    }

    /**
     * Languages deleted by this user
     */
    public function deletedLanguages()
    {
        return $this->hasMany(Language::class, 'deleted_by');
    }

    /**
     * Currencies created by this user
     */
    public function createdCurrencies()
    {
        return $this->hasMany(Currency::class, 'created_by');
    }

    /**
     * Currencies updated by this user
     */
    public function updatedCurrencies()
    {
        return $this->hasMany(Currency::class, 'updated_by');
    }

    /**
     * Currencies deleted by this user
     */
    public function deletedCurrencies()
    {
        return $this->hasMany(Currency::class, 'deleted_by');
    }

    /**
     * Timezones created by this user
     */
    public function createdTimezones()
    {
        return $this->hasMany(Timezone::class, 'created_by');
    }

    /**
     * Timezones updated by this user
     */
    public function updatedTimezones()
    {
        return $this->hasMany(Timezone::class, 'updated_by');
    }

    /**
     * Timezones deleted by this user
     */
    public function deletedTimezones()
    {
        return $this->hasMany(Timezone::class, 'deleted_by');
    }
}
