package shop.alien.storeplatform.controller;

import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import shop.alien.entity.result.R;
import shop.alien.entity.store.StoreBusinessInfo;
import shop.alien.entity.store.vo.StoreDictionaryVo;
import shop.alien.entity.store.vo.StoreMainInfoVo;
import shop.alien.storeplatform.service.StorePlatformInfoService;
import shop.alien.storeplatform.service.StorePlatformRenovationService;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@Api(tags = {"商户平台-门店装修"})
@ApiSort(1)
@CrossOrigin
@RestController
@RequiredArgsConstructor
@RequestMapping("/storePlatformRenovation")
public class StorePlatformRenovationController {

    private final StorePlatformRenovationService storePlatformRenovationService;

    private final StorePlatformInfoService storePlatformInfoService;

    @ApiOperation(value = "web端查询经营板块信息")
    @ApiOperationSupport(order = 6)
    @GetMapping("/getBusinessSection")
    public R<List<StoreDictionaryVo>> getBusinessSection() {
        log.info("StoreInfoController.getBusinessSection");
        return R.data(storePlatformRenovationService.getBusinessSection());
    }

    @ApiOperation(value = "web端查询经营板块的经营种类信息")
    @ApiOperationSupport(order = 6)
    @GetMapping("/getBusinessSectionTypes")
    public R<List<StoreDictionaryVo>> getBusinessSectionTypes(@RequestParam("parentId") String parentId) {
        log.info("StoreInfoController.getBusinessSectionTypes?parentId={}", parentId);
        return R.data(storePlatformRenovationService.getBusinessSectionTypes(parentId));
    }

    @ApiOperation(value = "门店装修-详细信息")
    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "门店id", dataType = "Long", paramType = "query", required = true)})
    @GetMapping("/getDecorationDetail")
    public R<StoreMainInfoVo> getDecorationDetail(Integer id) {
        log.info("StorePlatformRenovationController.getDecorationDetail?id={}", id);
        return R.data(storePlatformRenovationService.getDecorationDetail(id));
    }

    @ApiOperation(value = "门店装修-门店营业时间")
    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "门店id", dataType = "Long", paramType = "query", required = true)})
    @GetMapping("/getStoreInfoBusinessHours")
    public R<List<StoreBusinessInfo>> getStoreInfoBusinessHours(Integer id) {
        log.info("StoreInfoController.getStoreInfoBusinessHours?id={}", id);
        return R.data(storePlatformInfoService.getStoreInfoBusinessHours(id));
    }

}
