<?php

namespace Modules\Mall\Http\Controllers\Api;

use App\Api\Controllers\Controller;
use Illuminate\Http\JsonResponse;
use Modules\Mall\Http\Resources\Api\Activity\ActivityBaseResource;
use Modules\Mall\Http\Resources\Api\Activity\ActivityResource;
use Modules\Mall\Models\Activity;

class ActivityController extends Controller
{

    /**
     * Notes: 活动列表
     *
     * @Author: 玄尘
     * @Date: 2022/7/27 11:26
     * @return JsonResponse
     */
    public function index(): JsonResponse
    {
        $activities = Activity::shown()->get();

        return $this->success(ActivityBaseResource::collection($activities));
    }

    public function show(Activity $activity)
    {
        return $this->success(new ActivityResource($activity));
    }


}
