package models

import (
	"database/sql/driver"
)

// The software a server is running
type ServerSoftwareType string

const (
	// Mastodon and forks (glitch-soc, etc)
	ServerSoftwareMastodon = ServerSoftwareType("Mastodon")
	// Misskey and forks (Ice Shrimp, Sharkey, Cutiekey, etc)
	ServerSoftwareMisskey = ServerSoftwareType("Misskey")
	// Plemora and Akkoma
	ServerSoftwarePlemora = ServerSoftwareType("Plemora")
	// Wafrn with no known forks
	ServerSoftwareWafrn = ServerSoftwareType("Wafrn")
	// Linstrom with no known forks
	ServerSoftwareLinstrom = ServerSoftwareType("Linstrom")
)

// A list of all known server software systems
var AllServerSoftwareTypes = []ServerSoftwareType{
	ServerSoftwareMastodon,
	ServerSoftwareMisskey,
	ServerSoftwarePlemora,
	ServerSoftwareWafrn,
	ServerSoftwareLinstrom,
}

func (r *ServerSoftwareType) Value() (driver.Value, error) {
	return r, nil
}

func (ct *ServerSoftwareType) Scan(value any) error {
	*ct = ServerSoftwareType(value.(string))
	return nil
}
