package io.delphiplatform.api.v3.decibelrdb.entity;

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

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import lombok.Getter;
import lombok.Setter;

import static io.delphiplatform.api.v3.constant.DecibelTableNames.DECIBEL_SCHEMA;
import static io.delphiplatform.api.v3.constant.DecibelTableNames.PROJECTS;

@Getter
@Setter
@Entity
@Table(name = PROJECTS, schema = DECIBEL_SCHEMA)
public class DecibelProjectEntity {

    @Id
    private String id;
    private String name;
    private BigDecimal budget;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "decibel_label_id")
    private DecibelLabelEntity labelEntity;
    private LocalDate startDate;
    private LocalDate endDate;
    private Boolean isConfidential;

    @OneToMany(mappedBy = "userProjectId.projectId")
    private Set<DecibelUserProjectEntity> users;

    @OneToMany(mappedBy = "projectArtistId.projectId")
    private Set<DecibelProjectArtistEntity> artists;
}
