package services

import (
	clitypes "gitlink.org.cn/cloudream/jcs-pub/client/types"
	"gitlink.org.cn/cloudream/jcs-pub/common/models/datamap"
)

func getBlockTypeFromRed(red clitypes.Redundancy) string {
	switch red.(type) {
	case *clitypes.NoneRedundancy:
		return datamap.BlockTypeRaw

	case *clitypes.ECRedundancy:
		return datamap.BlockTypeEC

	case *clitypes.LRCRedundancy:
		return datamap.BlockTypeEC

	case *clitypes.SegmentRedundancy:
		return datamap.BlockTypeSegment
	}
	return ""
}
