'boolean', 'allow_overlap' => 'boolean', 'events_during_shift' => 'array', 'slots_total' => 'integer', 'slots_open_for_claiming' => 'integer', ]; } public function festivalSection(): BelongsTo { return $this->belongsTo(FestivalSection::class); } public function timeSlot(): BelongsTo { return $this->belongsTo(TimeSlot::class); } public function location(): BelongsTo { return $this->belongsTo(Location::class); } public function assignedCrew(): BelongsTo { return $this->belongsTo(User::class, 'assigned_crew_id'); } public function shiftAssignments(): HasMany { return $this->hasMany(ShiftAssignment::class); } public function waitlist(): HasMany { return $this->hasMany(ShiftWaitlist::class); } protected function effectiveStartTime(): Attribute { return Attribute::get(fn () => $this->actual_start_time ?? $this->timeSlot?->start_time); } protected function effectiveEndTime(): Attribute { return Attribute::get(fn () => $this->actual_end_time ?? $this->timeSlot?->end_time); } protected function filledSlots(): Attribute { return Attribute::get(fn () => $this->shiftAssignments()->where('status', 'approved')->count()); } protected function fillRate(): Attribute { return Attribute::get(function () { if ($this->slots_total === 0) { return 0; } return round($this->filled_slots / $this->slots_total, 2); }); } public function scopeOpen(Builder $query): Builder { return $query->where('status', 'open'); } public function scopeDraft(Builder $query): Builder { return $query->where('status', 'draft'); } public function scopeFull(Builder $query): Builder { return $query->where('status', 'full'); } }