<?php

namespace lib\Core;

use lib\Core\Database\DB;
use lib\Core\Database\QueryBuilder;

abstract class Model extends QueryBuilder
{
    public function __construct()
    {
        DB::init(); // ✅ 여기서 초기화
        parent::__construct(DB::getPDO()); // QueryBuilder에 전달
        parent::table($this->getTable());
        parent::setDebug($_ENV['DATABASE_QUERY_DEBUG'] ?? $_SERVER['DATABASE_QUERY_DEBUG'] ?? false);
    }

    abstract public function getTable(): string;
    abstract public function getPKField(): string;
    abstract public function getTitleField(): string;
}
