package com.td.boss.game.complayercultivate.controller;

import cn.hutool.core.convert.Convert;
import com.td.boss.common.pojo.Result;
import com.td.boss.config.enums.ResultEnum;
import com.td.boss.game.comexplainland.service.ComExplainLandService;
import com.td.boss.game.comexplainland.vo.ComExplainLandVo;
import com.td.boss.game.commallseed.service.ComMallSeedService;
import com.td.boss.game.commallseed.vo.ComMallSeedVo;
import com.td.boss.game.complayercultivate.serivce.ComPlayerCultivateSerivce;
import com.td.boss.game.complayergoods.pojo.ComPlayerGoods;
import com.td.boss.game.complayergoods.service.ComPlayerGoodsService;
import com.td.boss.game.complayergoods.vo.ComPlayerGoodsVo;
import com.td.boss.game.complayerland.pojo.ComPlayerLand;
import com.td.boss.game.complayerland.service.ComPlayerLandService;
import com.td.boss.game.complayerland.vo.ComPlayerLandAndPlantVo;
import com.td.boss.game.complayerland.vo.ComPlayerLandVo;
import com.td.boss.game.complayerlog.service.ComPlayerLogService;
import com.td.boss.game.complayerlog.vo.ComPlayerLogVo;
import com.td.boss.util.CopyUtil;
import com.td.boss.util.DateUtil;
import com.td.boss.util.UUIDUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.Date;


/**
 * 放牧\养殖\渔场
 */
@RestController
@Slf4j
@RequestMapping("/game/comPlayerCultivate/")
public class ComPlayerCultivateController {
    @Autowired
    private ComPlayerCultivateSerivce comPlayerCultivateSerivce;

    /**
     * 解锁某个土地 【牧场养殖渔场】
     *
     * @param userId
     * @param configLandId
     * @return
     */
    @PostMapping("payLand")
    @Transactional(rollbackFor = Exception.class)
    public Result<?> payLand(@RequestParam(value = "userId") String userId,
                             @RequestParam(value = "configLandId") Integer configLandId) {
        return comPlayerCultivateSerivce.payLand(userId, configLandId);
    }


    /**
     * 修改某个土地 【牧场养殖渔场】
     *
     * @param userId
     * @param configLandId
     * @param multiple
     * @return
     */
    @PostMapping("multipleLand")
    @Transactional(rollbackFor = Exception.class)
    public Result<?> multipleLand(@RequestParam(value = "userId") String userId,
                                  @RequestParam(value = "configLandId") Integer configLandId,
                                  @RequestParam(value = "multiple") Integer multiple) {
        return comPlayerCultivateSerivce.multipleLand(userId, configLandId,multiple);
    }

    /**
     * 获取租赁机会
     *
     * @param userId
     * @return
     */
    @GetMapping("getTimes")
    @Transactional(rollbackFor = Exception.class)
    public Result<?> getTimes(@RequestParam(value = "userId") String userId) {
        return Result.of(comPlayerCultivateSerivce.getTimes(userId));
    }


    /**
     * 喂养养殖场动物
     *
     * @param userId
     * @param configLandId
     * @return
     */
    @PostMapping("buyAnimalFood")
    @Transactional(rollbackFor = Exception.class)
    public Result<?> buyAnimalFood(@RequestParam(value = "userId") String userId,
                                   @RequestParam(value = "configLandId") Integer configLandId) {
        return comPlayerCultivateSerivce.buyFood(userId, configLandId);
    }
}
