<?php

namespace Modules\Mall\Http\Resources\Api\Order;

use Illuminate\Http\Resources\Json\JsonResource;
use Modules\Mall\Http\Resources\Api\Shop\ShopBaseInfoResource;

class OrderPayResource extends JsonResource
{

    public function toArray($request): array
    {
        return [
            'order_no'         => $this->order_no,
            'shop'             => new ShopBaseInfoResource($this->shop),
            'amount'           => $this->amount,
            'freight'          => $this->freight,
            'total'            => $this->total,
            'type'             => $this->type_text,
            'state'            => $this->state_text,
            'items'            => OrderItemResource::collection($this->items),
            'remark'           => (string) $this->remark,
            'created_at'       => (string) $this->created_at,
        ];
    }

}
