// Copyright (C) 2019 Marius Schellenberger

package authdav

import (
	"os"
	"time"
)

// FileInfo is a wrapper for os.FileInfo which always raturns a zero length for regular files
type FileInfo struct {
	fi os.FileInfo
}

func (fi *FileInfo) Name() string {
	return fi.fi.Name()
}

func (fi *FileInfo) RealSize() int64 {
	return fi.fi.Size()
}

func (fi *FileInfo) Size() int64 {
	if fi.Mode().IsRegular() {
		return 0
	}
	return fi.fi.Size()
}

func (fi *FileInfo) Mode() os.FileMode {
	return fi.fi.Mode()
}

func (fi *FileInfo) ModTime() time.Time {
	return fi.fi.ModTime()
}

func (fi *FileInfo) IsDir() bool {
	return fi.fi.IsDir()
}

func (fi *FileInfo) Sys() interface{} {
	return fi.fi.Sys()
}
