// Copyright (C) 2019 Marius Schellenberger

package core

import "html/template"

type User struct {
	Username string
	Password string
	Secret   string
	Locked   int
}

type Result struct {
	ID      string
	Path    string
	Keyword string
	HTML    template.HTML
}

type Results []Result

type Path struct {
	Name string
	Abs  string
	Flag bool
}

type Paths []Path

func (p Paths) Len() int           { return len(p) }
func (p Paths) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }
func (p Paths) Less(i, j int) bool { return p[i].Name < p[j].Name }

type Config struct {
	RunDir       string `json:"run_dir,omitempty"`
	DataDir      string `json:"-"`
	User         string `json:"user,omitempty"`
	Group        string `json:"group,omitempty"`
	ListenAddr   string `json:"listen_addr,omitempty"`
	LogFile      string `json:"log_file,omitempty"`
	Version      string `json:"-"`
	Secret       string `json:"secret,omitempty"`
	Foreground   bool   `json:"foreground,omitempty"`
	SecureCookie bool   `json:"secure_cookie,omitempty"`
	Debug        bool   `json:"debug,omitempty"`
}
