package dev.dinauer.maven.jpa.events;

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

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

    @Column(name = "group_id")
    private String groupId;

    @Column(name = "artifact_id")
    private String artifactId;

    private String version;

    @OneToOne(mappedBy = "resource")
    @JsonBackReference
    private Event event;

    public String getId()
    {
        return id;
    }

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

    public String getGroupId()
    {
        return groupId;
    }

    public Resource setGroupId(String groupId)
    {
        this.groupId = groupId;
        return this;
    }

    public String getArtifactId()
    {
        return artifactId;
    }

    public Resource setArtifactId(String artifactId)
    {
        this.artifactId = artifactId;
        return this;
    }

    public String getVersion()
    {
        return version;
    }

    public Resource setVersion(String version)
    {
        this.version = version;
        return this;
    }

    public Event getEvent()
    {
        return event;
    }

    public Resource setEvent(Event event)
    {
        this.event = event;
        return this;
    }
}
