<?php
namespace App\Models;

use Core\Database;

class Token
{
    private $pdo;

    public function __construct()
    {
        // Ambil instance PDO dari class Database
        $this->pdo = Database::getConnection();
    }

    public function getTokenSidang($token, $kegiatan)
    {
		$kegiatan = 'Sidang Skripsi';
        $sql = "SELECT * FROM tb_token WHERE token = ? AND kegiatan = ? LIMIT 1";
        $stmt = $this->pdo->prepare($sql);
        $stmt->execute([$token, $kegiatan]);
        return $stmt->fetch();
    }

    public function deleteToken($id_token)
    {
        $sql = "DELETE FROM tb_token WHERE id_token = ?";
        $stmt = $this->pdo->prepare($sql);
        return $stmt->execute([$id_token]);
    }
}
