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

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

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

    private String md5;

    private String sha1;

    @Column(columnDefinition = "bytea")
    private byte[] jar;

    private String classifier;

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

    public String getId()
    {
        return id;
    }

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

    public String getMd5()
    {
        return md5;
    }

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

    public String getSha1()
    {
        return sha1;
    }

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

    public byte[] getJar()
    {
        return jar;
    }

    public SnapshotJar setJar(byte[] jar)
    {
        this.jar = jar;
        return this;
    }

    public String getClassifier()
    {
        return classifier;
    }

    public SnapshotJar setClassifier(String classifier)
    {
        this.classifier = classifier;
        return this;
    }

    public SnapshotBundle getSnapshotBundle()
    {
        return snapshotBundle;
    }

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