package de.avatic.taricdb.model;

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

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

import jakarta.validation.constraints.NotNull;

public class AppliedMeasure {

	@Id
	private Integer id;

	private LocalDate startDate;

	private LocalDate endDate;

	private String amount;
	
	@Column("order_number")
	private Integer orderNumber;

	@MappedCollection(idColumn = "applied_measure_id")
	private Set<MeasureFootnote> measureFootnotes;

	@NotNull
	@Column("measure_id")
	private AggregateReference<Measure, Integer> measure;


	@Column("legal_base_id")
	private AggregateReference<LegalBase, Integer> legalBase;
	
	@Column("legal_base")
	private String additionalLegalBase;

	@MappedCollection(idColumn = "applied_measure_id")
	private Set<MeasureExclusion> exclusions;

	@MappedCollection(idColumn = "applied_measure_id")
	private Set<AppliedMeasureCondition> conditions;

	public AppliedMeasure(AggregateReference<Measure, Integer> measure, Set<MeasureFootnote> measureFootnotes,
			AggregateReference<LegalBase, Integer> legalBase, String additionalLegalBase, Set<MeasureExclusion> exclusions,
			Set<AppliedMeasureCondition> conditions, LocalDate startDate, LocalDate endDate, String amount, Integer orderNumber) {
		this.measure = measure;
		this.measureFootnotes = measureFootnotes;
		this.legalBase = legalBase;
		this.exclusions = exclusions;
		this.conditions = conditions;
		this.startDate = startDate;
		this.endDate = endDate;
		this.amount = amount;
		this.orderNumber = orderNumber;
		this.additionalLegalBase = additionalLegalBase;
	}

	public Integer getId() {
		return id;
	}

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

	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 String getAmount() {
		return amount;
	}

	public void setAmount(final String amount) {
		this.amount = amount;
	}

	public AggregateReference<Measure, Integer> getMeasure() {
		return measure;
	}

	public void setMeasure(final AggregateReference<Measure, Integer> measure) {
		this.measure = measure;
	}

	public AggregateReference<LegalBase, Integer> getLegalBase() {
		return legalBase;
	}

	public void setLegalBase(final AggregateReference<LegalBase, Integer> legalBase) {
		this.legalBase = legalBase;
	}
	
	public Integer getOrderNumber() {
		return orderNumber;
	}

	public Set<MeasureFootnote> getMeasureFootnotes() {
		return measureFootnotes;
	}

	public Set<MeasureExclusion> getExclusions() {
		return exclusions;
	}

	public Set<AppliedMeasureCondition> getConditions() {
		return conditions;
	}

}
