package storagedrivers

import (
	"github.com/owncloud/ocis/storage/pkg/config"
)

func UserDrivers(cfg *config.Config) map[string]interface{} {
	return map[string]interface{}{
		"eos": map[string]interface{}{
			"namespace":              cfg.Reva.UserStorage.EOS.Root,
			"shadow_namespace":       cfg.Reva.UserStorage.EOS.ShadowNamespace,
			"uploads_namespace":      cfg.Reva.UserStorage.EOS.UploadsNamespace,
			"share_folder":           cfg.Reva.UserStorage.EOS.ShareFolder,
			"eos_binary":             cfg.Reva.UserStorage.EOS.EosBinary,
			"xrdcopy_binary":         cfg.Reva.UserStorage.EOS.XrdcopyBinary,
			"master_url":             cfg.Reva.UserStorage.EOS.MasterURL,
			"slave_url":              cfg.Reva.UserStorage.EOS.SlaveURL,
			"cache_directory":        cfg.Reva.UserStorage.EOS.CacheDirectory,
			"sec_protocol":           cfg.Reva.UserStorage.EOS.SecProtocol,
			"keytab":                 cfg.Reva.UserStorage.EOS.Keytab,
			"single_username":        cfg.Reva.UserStorage.EOS.SingleUsername,
			"enable_logging":         cfg.Reva.UserStorage.EOS.EnableLogging,
			"show_hidden_sys_files":  cfg.Reva.UserStorage.EOS.ShowHiddenSysFiles,
			"force_single_user_mode": cfg.Reva.UserStorage.EOS.ForceSingleUserMode,
			"use_keytab":             cfg.Reva.UserStorage.EOS.UseKeytab,
			"gatewaysvc":             cfg.Reva.UserStorage.EOS.GatewaySVC,
		},
		"eoshome": map[string]interface{}{
			"namespace":              cfg.Reva.UserStorage.EOS.Root,
			"shadow_namespace":       cfg.Reva.UserStorage.EOS.ShadowNamespace,
			"uploads_namespace":      cfg.Reva.UserStorage.EOS.UploadsNamespace,
			"share_folder":           cfg.Reva.UserStorage.EOS.ShareFolder,
			"eos_binary":             cfg.Reva.UserStorage.EOS.EosBinary,
			"xrdcopy_binary":         cfg.Reva.UserStorage.EOS.XrdcopyBinary,
			"master_url":             cfg.Reva.UserStorage.EOS.MasterURL,
			"slave_url":              cfg.Reva.UserStorage.EOS.SlaveURL,
			"cache_directory":        cfg.Reva.UserStorage.EOS.CacheDirectory,
			"sec_protocol":           cfg.Reva.UserStorage.EOS.SecProtocol,
			"keytab":                 cfg.Reva.UserStorage.EOS.Keytab,
			"single_username":        cfg.Reva.UserStorage.EOS.SingleUsername,
			"user_layout":            cfg.Reva.UserStorage.EOS.UserLayout,
			"enable_logging":         cfg.Reva.UserStorage.EOS.EnableLogging,
			"show_hidden_sys_files":  cfg.Reva.UserStorage.EOS.ShowHiddenSysFiles,
			"force_single_user_mode": cfg.Reva.UserStorage.EOS.ForceSingleUserMode,
			"use_keytab":             cfg.Reva.UserStorage.EOS.UseKeytab,
			"gatewaysvc":             cfg.Reva.UserStorage.EOS.GatewaySVC,
		},
		"eosgrpc": map[string]interface{}{
			"namespace":              cfg.Reva.UserStorage.EOS.Root,
			"shadow_namespace":       cfg.Reva.UserStorage.EOS.ShadowNamespace,
			"share_folder":           cfg.Reva.UserStorage.EOS.ShareFolder,
			"eos_binary":             cfg.Reva.UserStorage.EOS.EosBinary,
			"xrdcopy_binary":         cfg.Reva.UserStorage.EOS.XrdcopyBinary,
			"master_url":             cfg.Reva.UserStorage.EOS.MasterURL,
			"master_grpc_uri":        cfg.Reva.UserStorage.EOS.GrpcURI,
			"slave_url":              cfg.Reva.UserStorage.EOS.SlaveURL,
			"cache_directory":        cfg.Reva.UserStorage.EOS.CacheDirectory,
			"sec_protocol":           cfg.Reva.UserStorage.EOS.SecProtocol,
			"keytab":                 cfg.Reva.UserStorage.EOS.Keytab,
			"single_username":        cfg.Reva.UserStorage.EOS.SingleUsername,
			"user_layout":            cfg.Reva.UserStorage.EOS.UserLayout,
			"enable_logging":         cfg.Reva.UserStorage.EOS.EnableLogging,
			"show_hidden_sys_files":  cfg.Reva.UserStorage.EOS.ShowHiddenSysFiles,
			"force_single_user_mode": cfg.Reva.UserStorage.EOS.ForceSingleUserMode,
			"use_keytab":             cfg.Reva.UserStorage.EOS.UseKeytab,
			"enable_home":            false,
			"gatewaysvc":             cfg.Reva.UserStorage.EOS.GatewaySVC,
		},
		"local": map[string]interface{}{
			"root":         cfg.Reva.UserStorage.Local.Root,
			"share_folder": cfg.Reva.UserStorage.Local.ShareFolder,
		},
		"localhome": map[string]interface{}{
			"root":         cfg.Reva.UserStorage.Local.Root,
			"share_folder": cfg.Reva.UserStorage.Local.ShareFolder,
			"user_layout":  cfg.Reva.UserStorage.Local.UserLayout,
		},
		"owncloudsql": map[string]interface{}{
			"datadirectory":   cfg.Reva.UserStorage.OwnCloudSQL.Root,
			"upload_info_dir": cfg.Reva.UserStorage.OwnCloudSQL.UploadInfoDir,
			"share_folder":    cfg.Reva.UserStorage.OwnCloudSQL.ShareFolder,
			"user_layout":     cfg.Reva.UserStorage.OwnCloudSQL.UserLayout,
			"enable_home":     false,
			"dbusername":      cfg.Reva.UserStorage.OwnCloudSQL.DBUsername,
			"dbpassword":      cfg.Reva.UserStorage.OwnCloudSQL.DBPassword,
			"dbhost":          cfg.Reva.UserStorage.OwnCloudSQL.DBHost,
			"dbport":          cfg.Reva.UserStorage.OwnCloudSQL.DBPort,
			"dbname":          cfg.Reva.UserStorage.OwnCloudSQL.DBName,
			"userprovidersvc": cfg.Reva.Users.Endpoint,
		},
		"ocis": map[string]interface{}{
			"root":                cfg.Reva.UserStorage.OCIS.Root,
			"user_layout":         cfg.Reva.UserStorage.OCIS.UserLayout,
			"share_folder":        cfg.Reva.UserStorage.OCIS.ShareFolder,
			"treetime_accounting": true,
			"treesize_accounting": true,
			"permissionssvc":      cfg.Reva.Permissions.Endpoint,
		},
		"s3": map[string]interface{}{
			"enable_home": false,
			"region":      cfg.Reva.UserStorage.S3.Region,
			"access_key":  cfg.Reva.UserStorage.S3.AccessKey,
			"secret_key":  cfg.Reva.UserStorage.S3.SecretKey,
			"endpoint":    cfg.Reva.UserStorage.S3.Endpoint,
			"bucket":      cfg.Reva.UserStorage.S3.Bucket,
			"prefix":      cfg.Reva.UserStorage.S3.Root,
		},
		"s3ng": map[string]interface{}{
			"root":                cfg.Reva.UserStorage.S3NG.Root,
			"user_layout":         cfg.Reva.UserStorage.S3NG.UserLayout,
			"share_folder":        cfg.Reva.UserStorage.S3NG.ShareFolder,
			"treetime_accounting": true,
			"treesize_accounting": true,
			"permissionssvc":      cfg.Reva.Permissions.Endpoint,
			"s3.region":           cfg.Reva.UserStorage.S3NG.Region,
			"s3.access_key":       cfg.Reva.UserStorage.S3NG.AccessKey,
			"s3.secret_key":       cfg.Reva.UserStorage.S3NG.SecretKey,
			"s3.endpoint":         cfg.Reva.UserStorage.S3NG.Endpoint,
			"s3.bucket":           cfg.Reva.UserStorage.S3NG.Bucket,
		},
	}
}
