package buckets

import (
	"fmt"

	"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal/schema/common"
	"github.com/gdamore/tcell/v2"
)

func (b *PrefixBucket) String() string {
	return common.FormatSimple(
		fmt.Sprintf("(%2d %-20s)", b.prefix, b.prefix), tcell.ColorLime,
	)
}

func (b *PrefixContainerBucket) String() string {
	return fmt.Sprintf(
		"%s CID %s",
		common.FormatSimple(
			fmt.Sprintf("(%2d %-20s)", b.prefix, b.prefix), tcell.ColorLime,
		),
		common.FormatSimple(b.id.String(), tcell.ColorAqua),
	)
}

func (b *UserBucket) String() string {
	return "UID " + common.FormatSimple(b.id.String(), tcell.ColorAqua)
}

func (b *ContainerBucket) String() string {
	return "CID " + common.FormatSimple(b.id.String(), tcell.ColorAqua)
}

func (b *UserAttributeKeyBucket) String() string {
	return fmt.Sprintf("%s CID %s ATTR-KEY %s",
		common.FormatSimple(
			fmt.Sprintf("(%2d %-20s)", b.prefix, b.prefix), tcell.ColorLime,
		),
		common.FormatSimple(
			fmt.Sprintf("%-44s", b.id), tcell.ColorAqua,
		),
		common.FormatSimple(b.key, tcell.ColorAqua),
	)
}

func (b *UserAttributeValueBucket) String() string {
	return "ATTR-VALUE " + common.FormatSimple(b.value, tcell.ColorAqua)
}