package edu.prlab.tyler.iotgateway.cloud.pojo.privacy;

import com.fasterxml.jackson.annotation.JsonIgnore;
import edu.prlab.tyler.iotgateway.cloud.pojo.privacy.p3p.Access;
import edu.prlab.tyler.iotgateway.cloud.pojo.privacy.p3p.Collector;
import edu.prlab.tyler.iotgateway.cloud.pojo.privacy.p3p.Dispute;
import edu.prlab.tyler.iotgateway.cloud.pojo.privacy.p3p.Remedy;
import edu.prlab.tyler.iotgateway.cloud.pojo.privacy.p3p.Statement;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
public class PrivacyPolicy {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private String id;
    private String description;

    @OneToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "collector_id")
    private Collector collector;

    @OneToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "dispute_id")
    private Dispute dispute;

    @Enumerated(EnumType.STRING)
    private Access access;

    @OneToMany(cascade = CascadeType.ALL)
    @JoinColumn(name = "remedy_id")
    @ElementCollection(targetClass = Remedy.class)
    private List<Remedy> remedies;

    @OneToMany(cascade = CascadeType.ALL)
    @JoinColumn(name = "statement_id")
    @ElementCollection(targetClass = Statement.class)
    private List<Statement> statements;

}
