package com.kiisoo.ic.synchronous.controller;

import com.kiisoo.ic.customer.CustomerService;
import com.kiisoo.ic.store.entity.PoiStore;
import com.kiisoo.ic.synchronous.entity.TurnBackDTO;
import com.kiisoo.ic.utils.DataImportUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


/**
 * 同步数据
 */
@Controller
@RequestMapping("/api")
@Slf4j
public class SynchronousController {

    private final CustomerService customerService;

    @Autowired
    public SynchronousController(CustomerService customerService) {
        this.customerService = customerService;
    }

    /**
     * 导入店铺接口
     * @return
     */
    @RequestMapping(value = "/shop/add",method = RequestMethod.POST)
    @ResponseBody
    public String addShop(@RequestBody List<PoiStore> PoiStores){
        return DataImportUtil.succ(1);
    }

    /**
     * 导入vip接口
     * @return
     */
    @RequestMapping(value = "/vip/add",method = RequestMethod.POST)
    @ResponseBody
    public String addVip(@RequestBody List<PoiStore> PoiStores){
        return DataImportUtil.succ(1);
    }

    /**
     * 导入导购接口
     * @return
     */
    @RequestMapping(value = "/staff/add",method = RequestMethod.POST)
    @ResponseBody
    public String addSeller(@RequestBody List<PoiStore> PoiStores){
        return DataImportUtil.succ(1);
    }

    /**
     * 好友添加回调通知
     * @return 是否成功
     */
    @RequestMapping(value = "/ics/customer",method = RequestMethod.POST)
    @ResponseBody
    public String turnBack(@RequestBody TurnBackDTO turnBackDTOS){
        customerService.turnBack(turnBackDTOS);
        return DataImportUtil.succ(1);
    }
}
