package dev.dinauer.maven.maven.core.release;

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

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

    @Column(columnDefinition = "bytea")
    @JsonIgnore
    @Basic(fetch = FetchType.LAZY)
    private byte[] jar;

    private String md5;

    private String sha1;

    private String url;

    private String filename;

    private String classifier;

    @ManyToOne(cascade = CascadeType.PERSIST)
    @JoinColumn(name = "release_version_id")
    @JsonBackReference
    private ReleaseVersion releaseVersion;

    public String getId()
    {
        return id;
    }

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

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

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

    public String getMd5()
    {
        return md5;
    }

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

    public String getSha1()
    {
        return sha1;
    }

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

    public ReleaseVersion getReleaseVersion()
    {
        return releaseVersion;
    }

    public ReleaseJar setReleaseVersion(ReleaseVersion releaseVersion)
    {
        this.releaseVersion = releaseVersion;
        return this;
    }

    public String getUrl()
    {
        return url;
    }

    public ReleaseJar setUrl(String url)
    {
        this.url = url;
        return this;
    }

    public String getFilename()
    {
        return filename;
    }

    public ReleaseJar setFilename(String filename)
    {
        this.filename = filename;
        return this;
    }

    public String getClassifier()
    {
        return classifier;
    }

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