package dev.dinauer.maven.maven.core.snapshot;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;

@Entity
@Table(name = "snapshot_pom")
public class SnapshotPom
{
    @Id
    @GeneratedValue(strategy = GenerationType.UUID)
    private String id;

    private String md5;

    private String sha1;

    @JsonIgnore
    @Column(columnDefinition = "TEXT")
    @Basic(fetch = FetchType.LAZY)
    private String pom;

    @OneToOne(cascade = CascadeType.PERSIST)
    @JoinColumn(name = "snapshot_bundle_id")
    @JsonBackReference
    private SnapshotBundle snapshotBundle;

    public String getId()
    {
        return id;
    }

    public SnapshotPom setId(String id)
    {
        this.id = id;
        return this;
    }

    public String getMd5()
    {
        return md5;
    }

    public SnapshotPom setMd5(String md5)
    {
        this.md5 = md5;
        return this;
    }

    public String getSha1()
    {
        return sha1;
    }

    public SnapshotPom setSha1(String sha1)
    {
        this.sha1 = sha1;
        return this;
    }

    public String getPom()
    {
        return pom;
    }

    public SnapshotPom setPom(String pom)
    {
        this.pom = pom;
        return this;
    }

    public SnapshotBundle getSnapshotBundle()
    {
        return snapshotBundle;
    }

    public SnapshotPom setSnapshotBundle(SnapshotBundle snapshotBundle)
    {
        this.snapshotBundle = snapshotBundle;
        return this;
    }
}
