package com.eactive.httpmockserver.client.entity;

import com.eactive.httpmockserver.user.entity.StaffUser;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

@Entity
@Table(name = "API_COLLECTION")
public class ApiCollection {

    @Id
    private String id; //uuid

    private String name;

    @ManyToOne
    @JoinColumn(name = "USER_ID")
    private StaffUser owner;

    @ManyToMany
    @JoinTable(
            name = "API_COLLECTION_API_REQUEST_INFO",
            joinColumns = @JoinColumn(name = "API_COLLECTION_ID"),
            inverseJoinColumns = @JoinColumn(name = "API_REQUEST_INFO_ID")
    )
    private List<ApiRequestInfo> apis = new ArrayList<>();

    public String getId() {
        return id;
    }

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

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<ApiRequestInfo> getApis() {
        return apis;
    }

    public void setApis(List<ApiRequestInfo> apis) {
        this.apis = apis;
    }

    public StaffUser getOwner() {
        return owner;
    }

    public void setOwner(StaffUser owner) {
        this.owner = owner;
    }
}
