package svc

import (
	"juwan-backend/app/snowflake/rpc/internal/config"
	generator "juwan-backend/app/snowflake/rpc/internal/pkg"
)

type ServiceContext struct {
	Config    config.Config
	Generator *generator.Snowflake
}

func NewServiceContext(c config.Config) *ServiceContext {
	gen, err := generator.NewSnowflake(
		c.Snowflake.DatacenterId,
		c.Snowflake.WorkerId,
	)
	if err != nil {
		panic(err)
	}
	return &ServiceContext{
		Config:    c,
		Generator: gen,
	}
}
