// Code scaffolded by goctl. Safe to edit.
// goctl 1.10.1

package file

import (
	"context"

	"github.com/zeromicro/go-zero/core/logx"
	"sundynix-micro-go/app/file/api/internal/svc"
	"sundynix-micro-go/app/file/api/internal/types"
	"sundynix-micro-go/app/file/rpc/fileservice"
)

type SetDefaultStorageConfigLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

// 设置默认存储配置
func NewSetDefaultStorageConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetDefaultStorageConfigLogic {
	return &SetDefaultStorageConfigLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *SetDefaultStorageConfigLogic) SetDefaultStorageConfig(req *types.SetDefaultStorageConfigReq) error {
	_, err := l.svcCtx.FileRpc.SetDefaultStorageConfig(l.ctx, &fileservice.SetDefaultStorageConfigReq{
		Id: req.Id,
	})
	if err != nil {
		return err
	}

	return nil
}
