package gui

import (
	tview "gitlab.com/tslocum/cview"
	"shiny-pancake/internal/model"
)

type resources struct {
	ActSess          []*model.Session
	//statsLocations []*model.Statistic
}


type activeSessions struct {
	*tview.Table
	sn chan *model.Session
	filterCol, filterTerm string
}


func newSessions(g *Gui) *activeSessions {
	sess := &activeSessions{
		Table: tview.NewTable(),
		sn:  make(chan *model.Session),
	}

	sess.SetBorder(true)
	sess.entries(g)
	return sess
}

func (t *activeSessions) name() string {
	return `activeSessions`
}



func (t *activeSessions) entries(g *Gui) {
	sss, err := g.db.UserSessions()
	if err != nil {
		return
	}

	g.state.resources.ActSess = sss
}

