package com.gic.haoban.manage.service.service.out.impl.contact;

import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.contact.ContactFollowDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactFollowQDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactFollowSearchQDTO;
import com.gic.haoban.manage.api.service.contact.ContactFollowApiService;
import com.gic.haoban.manage.service.service.contact.ContactFollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by wangzubo on 2022/11/1.
 */
@Service("contactFollowApiService")
public class ContactFollowApiServiceImpl implements ContactFollowApiService {

    @Autowired
    private ContactFollowService contactFollowService;

    @Override
    public ServiceResponse<Void> saveFollow(ContactFollowQDTO qdto) {
        contactFollowService.saveFollow(qdto);
        return ServiceResponse.success();
    }

    @Override
    public ServiceResponse<Void> saveBatchFollow(List<ContactFollowQDTO> list) {
        contactFollowService.saveBatchFollow(list);
        return ServiceResponse.success();
    }

    @Override
    public ServiceResponse<Page<ContactFollowDTO>> pageFollow(String enterpriseId, ContactFollowSearchQDTO searchQDTO, BasePageInfo pageInfo) {
        Page<ContactFollowDTO> page = contactFollowService.pageFollow(enterpriseId, searchQDTO, pageInfo);
        return ServiceResponse.success(page);
    }

    @Override
    public ServiceResponse<Map<String, ContactFollowDTO>> mapMemberLastFollow(String enterpriseId, String clerkId, List<String> memberIdList) {
        Map<String, ContactFollowDTO> map = contactFollowService.mapMemberLastFollow(enterpriseId, clerkId, memberIdList);
        return ServiceResponse.success(map);
    }
}
