<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Relations\BelongsTo;

class SectionPlacementBatchStudent extends BaseModel
{
    protected $table = 'section_placement_batch_students';

    public $timestamps = false;

    protected $fillable = [
        'batch_id',
        'student_id',
        'student_type',
        'source_decision_id',
        'source_enrollment_id',
        'final_score',
        'placement_score',
        'score_band',
        'placement_band_reason',
        'planned_section_index',
        'assigned_section_id',
        'assignment_order',
        'was_override',
        'override_reason',
        'created_at',
    ];

    protected $casts = [
        'batch_id' => 'integer',
        'student_id' => 'integer',
        'source_decision_id' => 'integer',
        'source_enrollment_id' => 'integer',
        'final_score' => 'float',
        'placement_score' => 'float',
        'planned_section_index' => 'integer',
        'assigned_section_id' => 'integer',
        'assignment_order' => 'integer',
        'was_override' => 'boolean',
        'created_at' => 'datetime',
    ];

    public function batch(): BelongsTo
    {
        return $this->belongsTo(SectionPlacementBatch::class, 'batch_id');
    }
}
