package _VisualDVM.ComponentsServer.SubscriberWorkspace;
import Common.Database.Tables.iDBTable;
import Common.Visual.DataSetControlForm;
import _VisualDVM.ComponentsServer.SubscriberWorkspace.UI.SubscriberWorkspacesForm;

import javax.swing.*;
public class SubscriberWorkspaceDBTable extends iDBTable<SubscriberWorkspace> {
    public SubscriberWorkspaceDBTable() {
        super(SubscriberWorkspace.class);
    }
    @Override
    public String getSingleDescription() {
        return "рабочая папка";
    }
    @Override
    public String getPluralDescription() {
        return "рабочие папки";
    }
    public SubscriberWorkspace findWorkspace(String email, String machineURL, String login) {
        return this.Data.values().stream().filter(subscriberWorkspace ->
                subscriberWorkspace.email.equals(email) &&
                        subscriberWorkspace.URL.equals(machineURL) &&
                        subscriberWorkspace.login.equals(login)).findFirst().orElse(null);
    }
    //--
    @Override
    protected DataSetControlForm createUI(JPanel mountPanel) {
        return new SubscriberWorkspacesForm(this, mountPanel);
    }
}
