package de.thpeetz.kontor.tysc.data;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import de.thpeetz.kontor.common.data.AbstractEntity;
import jakarta.persistence.Entity;
import jakarta.persistence.Index;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(indexes = {@Index(columnList = "name, vendor_id")},
        uniqueConstraints = {@UniqueConstraint(columnNames = { "name", "vendor_id" })}
)
public class CardSet extends AbstractEntity {

    @NotEmpty
    private String name;

    @ManyToOne()
    @JoinColumn(name = "vendor_id")
    @NotNull
    @JsonIgnoreProperties({ "cardSets" })
    private Vendor vendor;

    private boolean parallelSet = false;

    private boolean insertSet = false;

    public String getVendorName() {
        return vendor.getName();
    }
}
