package com.izouma.jiashanxia.web;

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

