package com.muyu.event.eventDispose;


import com.muyu.event.basics.EventProcessBasics;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.log4j.Log4j2;

/**
 * @author 刘武
 * @package：
 * @name：StorageEvent
 * @date：2024/9/29
 */
@EqualsAndHashCode(callSuper = true)
@Log4j2
@Data
@AllArgsConstructor
public class StorageEvent extends EventProcessBasics {
    /**
     * 事件名称
     */
    private String eventName;

    @Override
    public void handleEvent(String eventKey) {
        if (eventKey.equals(eventName)){
            log.info("开始执行 [{}] 事件", eventKey);

        }else if (nextEvent != null){
            nextEvent.handleEvent(eventKey);
        }else {
            log.info("处理结束，最后处理的事件为 [{}]", eventKey);
        }
    }
}
