package atomfeed

import (
	"errors"
	"fmt"

	"github.com/google/uuid"
)

type ID struct {
	*CommonAttributes
	URI URI `xml:"uri"`
}

func NewID() *ID {
	return &ID{URI: URI(fmt.Sprint("urn:uuid:", uuid.New()))}
}

func (i *ID) Check() error {
	if i.URI == "" {
		return errors.New("uri element of id empty")
	}

	return nil
}