package cn.iselab.mooctest.user.rpc;

import cn.iselab.mooctest.rpc.user.api.MedalService;
import cn.iselab.mooctest.rpc.user.data.MedalCaughtDTO;
import cn.iselab.mooctest.rpc.user.data.MedalDTO;
import cn.iselab.mooctest.user.web.logic.MedalLogic;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author ROKG
 * @Description
 * @Date: Created in 下午12:02 2018/2/14
 * @Modified By:
 */
@Service(version = "1.0.0")
@Component
public class MedalRPC implements MedalService{

    @Autowired
    MedalLogic medalLogic;

    /**
     * save single medal
     * @param dto
     * @return medalTO
     */
    @Override
    public MedalDTO saveMedal(MedalDTO dto)
    {
        return medalLogic.saveMedal(dto);
    }

    /**
     * get single medal
     * @param medalId
     * @return
     */
    public MedalDTO getMedal(long medalId){
        return medalLogic.getMedal(medalId);
    }

    /**
     * update single medal
     * @param dto
     * @return medalCaughtDTO
     */
    @Override
    public MedalDTO updateMedal(MedalDTO dto){
        return medalLogic.updateMedal(dto);
    }

    /**
     * delete single medal
     * @param medalId medal's id
     * @return
     */
    @Override
    public void deleteMedal(long medalId){
        medalLogic.deleteMedal(medalId);
    }

    /**
     * get medal list
     * @param keyword
     * @return medalTO
     */
    @Override
    public List<MedalDTO> getMedals(String keyword,Long userId){
        return medalLogic.getMedals(keyword,userId);
    }

    /**
     * save user caught medal
     * @param dto
     * @return medalCaughtDTO
     */
    @Override
    public MedalCaughtDTO saveMedalCaughtDTO(MedalCaughtDTO dto){
        return medalLogic.saveMedalCaughtDTO(dto);
    }

    /**
     * get user's medals
     * @param userId user's id
     * @return medalCaughtDTO
     */
    @Override
    public List<MedalCaughtDTO> getMedalList(long userId){
        return medalLogic.getMedalList(userId);
    }
}
