package cn.newfeifan.mall.module.member.api.address;

import cn.newfeifan.mall.module.member.api.address.dto.MemberAddressRespDTO;
import cn.newfeifan.mall.module.member.convert.address.AddressConvert;
import cn.newfeifan.mall.module.member.service.address.AddressService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

/**
 * 用户收件地址 API 实现类
 *
 * @author 非繁源码
 */
@Service
@Validated
public class MemberAddressApiImpl implements MemberAddressApi {

    @Resource
    private AddressService addressService;

    @Override
    public MemberAddressRespDTO getAddress(Long id, Long userId,Integer addressType) {
        return AddressConvert.INSTANCE.convert02(addressService.getAddress(userId, id,addressType));
    }

    @Override
    public MemberAddressRespDTO getDefaultAddress(Long userId,Integer addressType) {
        return AddressConvert.INSTANCE.convert02(addressService.getDefaultUserAddress(userId,addressType));
    }

}
