package com.izouma.nineth.web.mobile.v1;


import com.izouma.nineth.domain.Activity;
import com.izouma.nineth.dto.PageQuery;
import com.izouma.nineth.service.ActivityService;
import com.izouma.nineth.web.BaseController;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/activity")
@AllArgsConstructor
public class ActivityControllerV1 extends BaseController {
    private ActivityService activityService;

    @PostMapping("/all")
    public Page<Activity> all(@RequestBody PageQuery pageQuery) {
        return activityService.all(pageQuery);
    }

    @GetMapping("/get/{id}")
    public Activity get(@PathVariable Long id) {
        return activityService.findById(id);
    }

    @GetMapping("/hasRead")
    public Map<String, Boolean> hasRead(){
        return activityService.hasRead();
    }

    @GetMapping("/contraction/{projectId}")
    public List<Activity> contraction(@PathVariable Integer projectId){
        return activityService.contraction(projectId);
    }

}

