package com.yuchen.saas.park.service.controller.property;

import com.yuchen.saas.park.api.entity.property.PropertyFeeMode;
import com.yuchen.saas.park.service.service.property.PropertyFeeModeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@Api(tags = "物业收费模式")
@RestController
@RequestMapping("/propertyFeeMode")
public class PropertyFeeModeController {

    @Autowired
    private PropertyFeeModeService propertyFeeModeService;

    @PostMapping("/save")
    @ApiOperation(value = "保存", notes = "保存")
    public R save(@Valid @RequestBody PropertyFeeMode saveDto) {
        propertyFeeModeService.saveFeeMode(saveDto);
        return R.success();
    }


    @GetMapping("/detail")
    @ApiOperation(value = "详情", notes = "详情")
    public R<PropertyFeeMode> detail(@RequestParam("parkId") Long parkId) {
        return R.data(propertyFeeModeService.getFeeMode(parkId));
    }

}
