package com.clx.performance.extranal.user.impl;

import com.clx.performance.extranal.user.UserService;
import com.clx.user.feign.TruckFeign;
import com.clx.user.vo.app.driver.truck.DriverTruckAppVo;
import com.msl.common.base.Optional;
import com.msl.common.result.Result;
import com.msl.user.param.user.external.PageProductUsersParam;
import com.msl.user.vo.company.external.ListUserCompanyVo;
import com.msl.user.vo.user.UserVo;
import com.msl.user.vo.user.external.PageProductUserVo;
import com.msl.user.vo.user.external.UserDetailInfoVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
@AllArgsConstructor
public class UserServiceImpl implements UserService {

    @Autowired
    private TruckFeign truckFeign;

    @Override
    public Optional<UserVo> getUserByNo(Long userNo, boolean containDeleted) {
        return null;
    }

    @Override
    public Optional<List<PageProductUserVo>> pageProductUsers(PageProductUsersParam param) {
        return null;
    }

    @Override
    public Optional<UserDetailInfoVo> getUserDetailInfo(Long userNo) {
        return null;
    }

    @Override
    public void bindUserProduct(Long userNo, String productCode) {

    }

    @Override
    public Optional<List<ListUserCompanyVo>> listUserCompany(Long userNo) {
        return null;
    }

    @Override
    public Optional<List<DriverTruckAppVo>> driverTruckList(Long userNo){

        return Optional.ofNullable(truckFeign.driverTruckList(userNo))
                .filter(Result::succeed)
                .map(Result::getData);

    }

}
