<?php

namespace Vidgyor\Schedule\Repositories\Presenter;

use League\Fractal\TransformerAbstract;
use Hashids;

class ScheduleTransformer extends TransformerAbstract
{
    public function transform(\Vidgyor\Schedule\Models\Schedule $schedule)
    {
        return [
            'id'                => $schedule->getRouteKey(),
            'key'               => [
                'public'    => $schedule->getPublicKey(),
                'route'     => $schedule->getRouteKey(),
            ], 
            'id'                => $schedule->id,
            'channel_id'        => $schedule->channel_id,
            'name'              => $schedule->name,
            'videos'            => $schedule->videos,
            'date'              => $schedule->date,
            'time'              => $schedule->time,
            'contents'          => $schedule->contents,
            'position'          => $schedule->position,
            'duration'          => $schedule->duration,
            'to_repeat'         => $schedule->to_repeat,
            'repeat_until'      => $schedule->repeat_until,
            'created_at'        => $schedule->created_at,
            'updated_at'        => $schedule->updated_at,
            'deleted_at'        => $schedule->deleted_at,
            'url'               => [
                'public'    => trans_url('schedule/'.$schedule->getPublicKey()),
                'user'      => guard_url('schedule/schedule/'.$schedule->getRouteKey()),
            ], 
            'status'            => trans('app.'.$schedule->status),
            'created_at'        => format_date($schedule->created_at),
            'updated_at'        => format_date($schedule->updated_at),
        ];
    }
}