package de.avatic.taricdb.model;

import java.time.LocalDate;
import java.util.HashSet;
import java.util.Set;

import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;

import jakarta.validation.constraints.Size;


@Table("footnote")
public class Footnote {

	@Id
    private Integer id;

    @Size(max = 8)
    @Column("footnote")
    private String footnote;

    @Column("start_date")
    private LocalDate startDate;


    @Column("end_date")
    private LocalDate endDate;

    @MappedCollection(idColumn = "ref_id")
    private Set<FootnotesDesc> footnotesDesc;

    public Footnote(String footnote, String descrption, LocalDate startDate, LocalDate endDate) {
		this.footnote = footnote;
		this.startDate = startDate;
		this.endDate = endDate;
		this.footnotesDesc = new HashSet<>();
	}

	public Integer getId() {
        return id;
    }

    public void setId(final Integer id) {
        this.id = id;
    }

    public String getFootnote() {
        return footnote;
    }

    public void setFootnote(final String footnote) {
        this.footnote = footnote;
    }

    public LocalDate getStartDate() {
        return startDate;
    }

    public void setStartDate(final LocalDate startDate) {
        this.startDate = startDate;
    }

    public LocalDate getEndDate() {
        return endDate;
    }

    public void setEndDate(final LocalDate endDate) {
        this.endDate = endDate;
    }

	public Set<FootnotesDesc> getFootnotesDesc() {
		return footnotesDesc;
	}

	public void addFootnotesDesc(FootnotesDesc footnotesDesc) {
		this.footnotesDesc.add(footnotesDesc);
	}

}
