package keks

import (
	"net"

	"github.com/google/uuid"
)

type Hexlet [16]byte

func (h *Hexlet) UUID() (u uuid.UUID) {
	copy(u[:], h[:])
	return
}

func (h *Hexlet) IP() (ip net.IP) {
	return net.IP(h[:])
}

func (h *Hexlet) MarshalJSON() ([]byte, error) {
	return []byte(`"HEXLET[` + h.UUID().String() + `]"`), nil
}
