package oauthprovider_admin

import (
	"net/http"

	"git.noahlan.cn/noahlan/ntool-biz/zero/statusz"
	"github.com/zeromicro/go-zero/rest/httpx"

	"git.noahlan.cn/n-admin/n-admin-server/api/internal/logic/oauthprovider_admin"
	"git.noahlan.cn/n-admin/n-admin-server/api/internal/svc"
	"git.noahlan.cn/n-admin/n-admin-server/api/internal/types"
)

// swagger:route get /api/admin/oauth_provider oauthprovider_admin GetOauthProviderAdmin
//
// Get oauth provider by Params | 根据条件获取第三方信息
//
// Get oauth provider by Params | 根据条件获取第三方信息
//
// Responses:
//  200: OauthProviderInfo

func GetOauthProviderAdminHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		const transErr = true
		var req types.OauthProviderReq
		if err := httpx.Parse(r, &req); err != nil {
			statusz.ResponseHandler(r, w, transErr, nil, err)
			return
		}

		l := oauthprovider_admin.NewGetOauthProviderAdminLogic(r, r.Context(), svcCtx)
		resp, err := l.GetOauthProviderAdmin(&req)

		statusz.ResponseHandler(r, w, transErr, resp, err)

	}
}
