package tracking

import (
	"context"
	"errors"
)

type Tracer struct {
	ID int
}

func WithContext(ctx context.Context, t *Tracer) context.Context {
	return context.WithValue(ctx, "ID", t)
}

func FromContext(ctx context.Context) (*Tracer, error) {
	t, ok := ctx.Value("ID").(*Tracer)
	if !ok {
		return nil, errors.New("tracer not found")
	}
	return t, nil
}
