<?php

namespace App\Http\Controllers\QuickApp\Book\Transformers;

use Hashids;

class ChapterListTransformer
{

    public function transform($chapter)
    {
        return [
            'bid'              => Hashids::encode($chapter->bid),
            'chapter_id'       => $chapter->id,
            'chapter_name'     => $chapter->name,
            'chapter_sequence' => $chapter->sequence,
            'chapter_is_vip'   => $chapter->is_vip,
            'chapter_size'     => $chapter->size,
            'need_coin'     => $chapter->is_need_charge ? 37:0,
            'prev_cid'         => $chapter->prev_cid,
            'next_cid'         => $chapter->next_cid,
            'recent_update_at' => $chapter->recent_update_at,
            'is_need_charge'   => $chapter->is_need_charge ? 1 : 0,
            'next_chapter_status'   => $chapter->next_chapter_status,
            'next_price'   => $chapter->next_price,
        ];
    }
}
