package com.bcxin.Infrastructures.entities;

import com.bcxin.Infrastructures.components.EventDispatcher;
import com.bcxin.Infrastructures.TenantContext;
import com.bcxin.Infrastructures.enums.CredentialType;
import com.bcxin.Infrastructures.events.DomainEventAbstract;

import java.io.Serializable;

public abstract class EntityAbstract implements Serializable {
    /*
    private static ThreadLocal<Set<DomainEventAbstract>> _domainEventsContainer = new ThreadLocal<>();
    static {
        _domainEventsContainer.set(new TreeSet<DomainEventAbstract>());
    }

     */

    protected void recordEvent(DomainEventAbstract domainEvent) {
        TenantContext.getInstance()
                .resolve(EventDispatcher.class)
                .dispatch(domainEvent);
    }


}
