package models

import "database/sql/driver"

// How one account relates to another
type RelationType string

const (
	RelationFollow        RelationType = "follow"         // X follows Y
	RelationMute          RelationType = "mute"           // X has Y muted (X doesn't see Y, but Y still X)
	RelationNoBoosts      RelationType = "no-boosts"      // X has Ys boosts muted
	RelationBlock         RelationType = "block"          // X has Y blocked (X doesn't see Y and Y doesn't see X)
	RelationPreventFollow RelationType = "prevent-follow" // X blocks Y from following (Y can still see X)
)

// List of all relation types known
var AllRelations = []RelationType{
	RelationFollow,
	RelationMute,
	RelationNoBoosts,
	RelationBlock,
	RelationPreventFollow,
}

func (ct *RelationType) Scan(value any) error {
	*ct = RelationType(value.([]byte))
	return nil
}

func (ct RelationType) Value() (driver.Value, error) {
	return string(ct), nil
}
