package dev.dinauer.maven.jpa.maven;

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

@Entity
@Table(name = "jar")
public class Jar
{
    @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;

    @ManyToOne
    @JoinColumn(name = "version_id")
    @JsonBackReference
    private Version version;

    public String getId()
    {
        return id;
    }

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

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

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

    public String getMd5()
    {
        return md5;
    }

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

    public String getSha1()
    {
        return sha1;
    }

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

    public Version getVersion()
    {
        return version;
    }

    public Jar setVersion(Version version)
    {
        this.version = version;
        return this;
    }

    public String getUrl()
    {
        return url;
    }

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

    public String getFilename()
    {
        return filename;
    }

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