WorkflowActionStepLang.java

/*
 * Copyright 2026 Global Crop Diversity Trust
 * Licensed under the Apache License, Version 2.0
 * See LICENSE file in project root folder or http://www.apache.org/licenses/LICENSE-2.0
 */

package org.gringlobal.model.workflow;

import java.util.Optional;
import javax.persistence.Column;
import javax.persistence.Entity;

import org.gringlobal.model.SysLang;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Entity
@Getter
@Setter
@NoArgsConstructor
public class WorkflowActionStepLang extends WorkflowStepLang {

	private static final long serialVersionUID = 6011436997462634376L;

	/** Optional info message for the step condition. */
	@Column(name = "condition_message")
	private String conditionMessage;

	/** Optional note for the step's action. */
	@Column(name = "action_note")
	private String actionNote;

	public WorkflowActionStepLang(Long id) {
		super(id);
	}

	public WorkflowActionStepLang(Optional<WorkflowActionStepLang> defaultTranslation, SysLang sysLang) {
		super(Optional.ofNullable(defaultTranslation.get()), sysLang);
		if (defaultTranslation.isPresent()) {
			this.conditionMessage = defaultTranslation.get().conditionMessage;
			this.actionNote = defaultTranslation.get().actionNote;
		}
	}

	@Override
	public boolean canEqual(Object other) {
		return other instanceof WorkflowActionStepLang;
	}
}