package com.hotwj.platform.securityManagement.securityMeeting.strategy;

import com.hotwj.platform.flow.domain.SysFlowInstance;
import com.hotwj.platform.flow.domain.dto.FlowNextDto;
import com.hotwj.platform.flow.strategy.IFlowStrategy;
import com.hotwj.platform.securityManagement.securityMeeting.domain.HotSecurityMeeting;
import com.hotwj.platform.securityManagement.securityMeeting.mapper.HotSecurityMeetingMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class SecurityMeetingSignStrategy implements IFlowStrategy {

    private final HotSecurityMeetingMapper meetingMapper;

    @Override
    public String getFlowCode() {
        return "MEETING_SIGN";
    }

    @Override
    public String getFlowName() {
        return "安全会议";
    }

    @Override
    public FlowNextDto next(SysFlowInstance instance, String currentNodeCode) {
        return null;
    }

    @Override
    public FlowNextDto getInitialNode(String businessId) {
        String nodeName = "安全会议签到";
        if (businessId != null) {
            HotSecurityMeeting meeting = meetingMapper.selectById(businessId);
            if (meeting != null && meeting.getMeetingTopic() != null) {
                nodeName = "安全会议：" + meeting.getMeetingTopic();
            }
        }
        return new FlowNextDto("NODE_MEETING_SIGN", nodeName, null);
    }
}

