package middlewares

import (
	"quyun/providers/app"
	"quyun/providers/jwt"

	"go.ipao.vip/atom/container"
	"go.ipao.vip/atom/opt"
)

func Provide(opts ...opt.Option) error {
	if err := container.Container.Provide(func(
		app *app.Config,
		jwt *jwt.JWT,
	) (*Middlewares, error) {
		obj := &Middlewares{
			app: app,
			jwt: jwt,
		}
		if err := obj.Prepare(); err != nil {
			return nil, err
		}

		return obj, nil
	}); err != nil {
		return err
	}
	return nil
}
