package dev.dinauer.maven.jpa.maven;

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

import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;

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

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

    @OneToMany(mappedBy = "group")
    @JsonManagedReference
    private List<ArtifactId> artifacts = new ArrayList<>();

    @Column(name = "updated_at")
    private ZonedDateTime updatedAt;

    @Column(name = "created_at")
    private ZonedDateTime createdAt;

    public String getId()
    {
        return id;
    }

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

    public String getGroupId()
    {
        return groupId;
    }

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

    public List<ArtifactId> getArtifacts()
    {
        return artifacts;
    }

    public GroupId setArtifacts(List<ArtifactId> artifactIds)
    {
        this.artifacts = artifactIds;
        return this;
    }

    public ZonedDateTime getUpdatedAt()
    {
        return updatedAt;
    }

    public GroupId setUpdatedAt(ZonedDateTime updatedAt)
    {
        this.updatedAt = updatedAt;
        return this;
    }

    public ZonedDateTime getCreatedAt()
    {
        return createdAt;
    }

    public GroupId setCreatedAt(ZonedDateTime createdAt)
    {
        this.createdAt = createdAt;
        return this;
    }
}
