<?php

namespace App\Http\Resources\Promotions;

use Illuminate\Http\Resources\Json\JsonResource;

class PromotionReminderResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'id' => (int) ($this->id ?? 0),
            'promotion_id' => (int) ($this->promotion_id ?? 0),
            'student_id' => $this->student_id ? (int) $this->student_id : null,
            'parent_id' => $this->parent_id ? (int) $this->parent_id : null,
            'reminder_type' => $this->reminder_type,
            'channel' => $this->channel,
            'subject' => $this->subject,
            'message' => $this->message,
            'sent_at' => optional($this->sent_at)->toDateTimeString(),
            'sent_by' => $this->sent_by ? (int) $this->sent_by : null,
        ];
    }
}
