<?php

namespace App\Http\Resources\Admin;

use Illuminate\Http\Resources\Json\JsonResource;

class ReportResource extends JsonResource
{
	/**
	 * Transform the resource into an array.
	 *
	 * @param \Illuminate\Http\Request $request
	 * @return array
	 */
	public function toArray($request)
	{
		return [
			'id'                       => $this->id,
			'code'                     => $this->code,
			'report_date'              => $this->report_date,
			'customer_id'              => $this->customer_id,
			'customer'                 => $this->customer,
			'charge_id'                => $this->charge_id,
			'charge'                   => $this->charge,
			'primary_member'           => $this->primary_member,
			'second_member'            => $this->second_member,
			'car'                      => $this->car,
			'notice'                   => $this->notice,
			'request'                  => $this->request,
			'on_site_cost'             => $this->on_site_cost,
			'address'                  => $this->address,
			'estimated_workload'       => $this->estimated_workload,
			'has_estimated'            => $this->has_estimated,
			'is_finished'              => $this->is_finished,
			'detail'                   => $this->detail,
			'user_id'                  => $this->user_id,
			'user'                     => $this->user,
			'progressing_user_id'      => $this->progressing_user_id,
			'progressing_user'         => $this->progressing_user,
			'leader_id'                => $this->leader_id,
			'reporter_id'              => $this->reporter_id,
			'report_created_at'        => $this->report_created_at,
			'is_allowed_single_report' => $this->is_allowed_single_report,
			'is_new'                   => $this->is_new,
			'is_activated'             => $this->is_activated,
			'is_deleted'               => $this->is_deleted,
			'created_at'               => isset($this->created_at) ? date('Y-m-d H:i:s', strtotime($this->created_at)) : null,
			'updated_at'               => isset($this->updated_at) ? date('Y-m-d H:i:s', strtotime($this->updated_at)) : null,
		];
	}
}
