namespace GB5Shared.Storage
{
///
/// Resolves a physical storage path from a configurable template and a .
/// The resolved path is relative to the storage root (base path).
/// Forward slashes are used as the separator — providers normalise to OS separators themselves.
///
public static class StoragePathResolver
{
///
/// Resolves all template tokens and returns a forward-slash-delimited relative path.
///
public static string Resolve(string template, StoragePathContext ctx)
{
return template
.Replace("{ClientId}", ctx.ClientId, StringComparison.Ordinal)
.Replace("{ObjectTypeCode}", ctx.ObjectTypeCode, StringComparison.Ordinal)
.Replace("{ObjectId}", ctx.ObjectId.ToString(), StringComparison.Ordinal)
.Replace("{Year}", ctx.Year.ToString(), StringComparison.Ordinal)
.Replace("{Month}", ctx.Month.ToString("D2"), StringComparison.Ordinal)
.Replace("{AttachmentId}", ctx.AttachmentId, StringComparison.Ordinal)
.Replace("{Ext}", ctx.Ext, StringComparison.Ordinal)
.Replace("{DocumentTypeCode}", ctx.DocumentTypeCode, StringComparison.Ordinal)
.Replace('\\', '/');
}
}
}