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

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import lombok.Getter;
import lombok.Setter;

@Entity(name = "dsp")
@Getter
@Setter
public class DspEntity extends TrackedEntity {

    @Id
    private String dspId;
    @Column(nullable = false)
    private String name;
    @Column(unique = true, nullable = false)
    private String slug;
    private Integer partnerKey;
    private String partnerCode;
    @Column(nullable = false)
    private boolean active = true;

    @OneToMany(mappedBy = "dsp")
    private Set<PlaylistEntity> playlists;
    @OneToMany(mappedBy = "dsp")
    private Set<PlaylistRankEntity> playlistRanks;
    @OneToMany(mappedBy = "dsp")
    private Set<ChartEntity> charts;

    public DspEntity dspId(String id) {
        this.dspId = id;
        return this;
    }

}
