<?php
declare(strict_types=1);

namespace App\Model\Table;

use Cake\ORM\Table;

class AvailabilitySlotsTable extends Table
{
    public function initialize(array $config): void
    {
        parent::initialize($config);

        $this->setTable('availability_slots');
        $this->setDisplayField('starts_at');
        $this->setPrimaryKey('id');
        $this->addBehavior('Timestamp');

        $this->belongsTo('Teachers', [
            'foreignKey' => 'teacher_id',
        ]);
        $this->hasMany('Bookings', [
            'foreignKey' => 'slot_id',
        ]);
    }
}
