<?php

namespace App\Modules\UserCompany\Models;

use App\Modules\UserCompany\Types\CompanyType;
use Illuminate\Support\Carbon;
use App\Models\User;
use App\Modules\Bank\Models\Bank;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
 * @property int $id [primary,unique]
 * @property CompanyType $company_type
 * @property string $name
 * @property string $ssb [unique]
 * @property string $hb [unique]
 * @property bool $default [default: false]
 * @property int $user_id
 * @property int $bank_id
 * @property Carbon $created_at
 * @property Carbon $updated_at
 */
class UserCompany extends Model
{
    /**
     * Get the attributes that should be cast.
     *
     * @return array<string, string>
     */
    protected function casts(): array
    {
        return [
            'default' => 'boolean',
        ];
    }

    /**
     * User
     *
     * @return BelongsTo<User, $this>
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }

    /**
     * Bank
     *
     * @return BelongsTo<Bank, $this>
     */
    public function bank(): BelongsTo
    {
        return $this->belongsTo(Bank::class);
    }
}
