<?php

namespace App\Repositories\Member;

use App\Models\Member\MemInfo;

class MemInfoRepository
{
    public function findByMemNo(int $memNo): ?MemInfo
    {
        return MemInfo::query()->where('mem_no', $memNo)->first();
    }

    public function emailsMatch(int $memNo, string $email): bool
    {
        $mem = $this->findByMemNo($memNo);
        if (!$mem || empty($mem->email)) return false;

        return strcasecmp((string)$mem->email, $email) === 0;
    }
}
