<?php

namespace App\Http\Resources;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class BatchResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @return array<string, mixed>
     */
    public function toArray(Request $request): array
    {
        return [
            "id" => $this->id,
            "farm_id" => $this->farm_id,
            "farm_name" => $this->farm_name,
            "building_id" => $this->building_id,
            "building_name" => $this->building_name,
            "batch_no" => $this->batch_no,
            "batch_sequence" => $this->batch_sequence,
            "start_date" => $this->start_date,
            "end_date" => $this->end_date,
            "status" => $this->status,
            "synced_id" => $this->synced_id,
            "synced_status" => $this->synced_status,
            "synced_at" => $this->synced_at,
            "initial_population" => $this->initial_population,
            "original_population" => $this->original_population,
            "current_population" => $this->current_population,
            "total_culled" => $this->total_culled,
            "attachment_path" => $this->attachment_path,
            "attachment_uploaded_at" => $this->attachment_uploaded_at,
            "loading" => new BatchLoadingResource($this->loading),
            "created_at" => $this->created_at,
            "updated_at" => $this->updated_at,
            "deleted_at" => $this->deleted_at
        ];
    }
}
