package com.izouma.zhirongip.web;

import com.izouma.zhirongip.domain.District;
import com.izouma.zhirongip.enums.DistrictLevel;
import com.izouma.zhirongip.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);
    }
}

