package ru.kirillius.pf.sdn.api.flow;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

import java.util.Map;

@Getter
@Setter
@Entity
public class StartCondition {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column
    private boolean dontStartIfRunning;

    @Column(length = 100)
    private TriggerType trigger;

    @ElementCollection(fetch = FetchType.EAGER)  // Подгружать сразу
    @CollectionTable(
            name = "start_condition_properties",
            joinColumns = @JoinColumn(name = "condition_id")
    )
    @MapKeyColumn(name = "prop_key")
    @Column(name = "prop_value")
    private Map<String, String> properties;

}
