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.MappedCollection;

import jakarta.validation.constraints.Size;


public class GeoGroup {

	@Id
    private Integer id;

    @Size(max = 4)
    private String geoGroupCode;

    private String abbr;

    private LocalDate startDate;

    private LocalDate endDate;
    
    @MappedCollection(idColumn = "geo_group_id")
    private Set<GeoGroupMembership> geoGroupMembers;
    
    @MappedCollection(idColumn = "ref_id")
    private Set<GeoGroupDesc> geoGroupDescs;
    

    public GeoGroup(String geoGroupCode, String abbr, LocalDate startDate, LocalDate endDate,
			Set<GeoGroupMembership> geoGroupMembers) {
		this.geoGroupCode = geoGroupCode;
		this.abbr = abbr;
		this.startDate = startDate;
		this.endDate = endDate;
		this.geoGroupMembers = geoGroupMembers;
		this.geoGroupDescs = new HashSet<>();
	}

	public Integer getId() {
        return id;
    }

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

    public String getGeoGroupCode() {
        return geoGroupCode;
    }

    public void setGeoGroupCode(final String geoGroupCode) {
        this.geoGroupCode = geoGroupCode;
    }

    public String getAbbr() {
        return abbr;
    }

    public void setAbbr(final String abbr) {
        this.abbr = abbr;
    }

    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 void addGeoGroupDesc(GeoGroupDesc geoGroupDesc) {
		this.geoGroupDescs.add(geoGroupDesc);
		
	}

}
