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

import edu.prlab.tyler.iotgateway.cloud.pojo.device.Device;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Cascade;

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

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

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

    @OneToOne
    @JoinColumn(name = "device_id")
    private Device device;

    @OneToMany(cascade = CascadeType.ALL)
    @JoinColumn(name = "policy_id")
    @ElementCollection(targetClass = PrivacyPolicy.class)
    private List<PrivacyPolicy> policies ;
}
