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

import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.api.qdto.chat.GroupChatActivityShareBindQDTO;
import com.gic.haoban.manage.api.service.chat.GroupChatActivityShareApiService;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatActivityShareBind;
import com.gic.haoban.manage.service.service.chat.GroupChatActivityShareBindService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("groupChatActivityShareApiService")
public class GroupChatActivityShareServiceImpl implements GroupChatActivityShareApiService {

    @Autowired
    private GroupChatActivityShareBindService activityShareBindService;

    @Override
    public ServiceResponse<Void> shareBing(GroupChatActivityShareBindQDTO shareBind) {
        String enterpriseId = shareBind.getEnterpriseId();
        Long chatActivityId = shareBind.getChatActivityId();
        String inviterMemberId = shareBind.getInviterMemberId();
        String inviteeUnionId = shareBind.getInviteeUnionId();
        if (chatActivityId == null || StringUtils.isAnyBlank(enterpriseId,inviteeUnionId, inviterMemberId)) {
            return ServiceResponse.failure("500","参数异常");
        }
        TabGroupChatActivityShareBind bind = EntityUtil.changeEntityNew(TabGroupChatActivityShareBind.class, shareBind);
        activityShareBindService.shareBing(bind);
        return ServiceResponse.success();
    }
}
