package com.eactive.eai.custom.alarm.event;

import java.util.Objects;

import com.eactive.eai.custom.alarm.condition.AlarmCondition;
import com.eactive.eai.custom.alarm.key.AlarmKey;
import com.eactive.eai.custom.alarm.policy.AlarmPolicy;
import com.eactive.eai.custom.alarm.policy.CounterPolicy;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Setter
@Getter
@Builder
@ToString
public class AlarmEvent {
	AlarmKey key;
	AlarmCondition condition;
	String message;
	
	public void onOcurr() {
		condition.onOcurr();
	}
	
	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (!(o instanceof AlarmEvent)) return false;

		AlarmEvent that = (AlarmEvent) o;
		return Objects.equals(this.key, that.key)
				&& Objects.equals(this.message, that.message);
	}

	@Override
	public int hashCode() {
		return Objects.hash(key, message);
	}
	
	
}
