package com.xy.service;

import com.xy.dto.SimInfoDto;
import com.xy.service.factory.sim.SimInfoFactory;
import com.xy.utils.FactoryUtils;
import com.xy.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * <p>
 * 物联网卡服务
 * </p>
 *
 * @author hechunping
 * @since 2024/8/20
 */
@Service
@AllArgsConstructor
@Api(tags = "物联网卡服务")
public class SimInfoServiceImpl implements SimInfoService {

    @Override
    @ApiOperation("物联网卡信息")
    public R<SimInfoDto.InfoVo> info(@RequestBody @Validated SimInfoDto.BaseDto dto) {
        return FactoryUtils.getServiceRoute(SimInfoFactory.class, dto.getIsp()).info(dto);
    }

    @Override
    @ApiOperation("刷新网络")
    public R<String> refreshNet(@RequestBody @Validated SimInfoDto.RefreshNetDto dto) {
        return FactoryUtils.getServiceRoute(SimInfoFactory.class,dto.getIsp()).refreshNet(dto);
    }

    @Override
    @ApiOperation("机卡重绑")
    public R<String> bindAgain(@RequestBody @Validated SimInfoDto.BindAgainDto dto) {
        return FactoryUtils.getServiceRoute(SimInfoFactory.class,dto.getIsp()).bindAgain(dto);
    }

    @Override
    @ApiOperation("加油包列表")
    public R<List<SimInfoDto.PackListVo>> packList(@RequestBody @Validated SimInfoDto.BaseDto dto) {
        return FactoryUtils.getServiceRoute(SimInfoFactory.class,dto.getIsp()).packList();
    }

    @Override
    @ApiOperation("购买加油包")
    public R<String> buyPack(@RequestBody @Validated SimInfoDto.BuyPackDto dto)  {
        return FactoryUtils.getServiceRoute(SimInfoFactory.class,dto.getIsp()).buyPack(dto);
    }

}
