package com.izouma.nineth.web;

import com.izouma.nineth.domain.District;
import com.izouma.nineth.enums.DistrictLevel;
import com.izouma.nineth.service.DistrictService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/district")
@AllArgsConstructor
public class DistrictController extends BaseController {
    private final DistrictService districtService;

    @GetMapping({"/", ""})
    public List<District> get(@RequestParam(required = false) DistrictLevel level,
                              @RequestParam(required = false) DistrictLevel maxLevel,
                              @RequestParam(required = false) Long parent) {
        return districtService.get(level, maxLevel, parent);
    }
}

