using Renci.SshNet.Common;
namespace Renci.SshNet.Sftp
{
    /// 
    /// Contains File system information exposed by statvfs@openssh.com request.
    /// 
    public class SftpFileSytemInformation
    {
        internal const ulong SSH_FXE_STATVFS_ST_RDONLY = 0x1;
        internal const ulong SSH_FXE_STATVFS_ST_NOSUID = 0x2;
        private ulong _flag;
        /// 
        /// Gets the file system block size.
        /// 
        /// 
        /// The file system block size.
        /// 
        public ulong FileSystemBlockSize { get; private set; }
        /// 
        /// Gets the fundamental file system size of the block.
        /// 
        /// 
        /// The fundamental file system block size.
        /// 
        public ulong BlockSize { get; private set; }
        /// 
        /// Gets the total blocks.
        /// 
        /// 
        /// The total blocks.
        /// 
        public ulong TotalBlocks { get; private set; }
        /// 
        /// Gets the free blocks.
        /// 
        /// 
        /// The free blocks.
        /// 
        public ulong FreeBlocks { get; private set; }
        /// 
        /// Gets the available blocks.
        /// 
        /// 
        /// The available blocks.
        /// 
        public ulong AvailableBlocks { get; private set; }
        /// 
        /// Gets the total nodes.
        /// 
        /// 
        /// The total nodes.
        /// 
        public ulong TotalNodes { get; private set; }
        /// 
        /// Gets the free nodes.
        /// 
        /// 
        /// The free nodes.
        /// 
        public ulong FreeNodes { get; private set; }
        /// 
        /// Gets the available nodes.
        /// 
        /// 
        /// The available nodes.
        /// 
        public ulong AvailableNodes { get; private set; }
        /// 
        /// Gets the sid.
        /// 
        /// 
        /// The sid.
        /// 
        public ulong Sid { get; private set; }
        /// 
        /// Gets a value indicating whether this instance is read only.
        /// 
        /// 
        /// true if this instance is read only; otherwise, false.
        /// 
        public bool IsReadOnly
        {
            get { return (_flag & SSH_FXE_STATVFS_ST_RDONLY) == SSH_FXE_STATVFS_ST_RDONLY; }
        }
        /// 
        /// Gets a value indicating whether [supports set uid].
        /// 
        /// 
        ///   true if [supports set uid]; otherwise, false.
        /// 
        public bool SupportsSetUid
        {
            get { return (_flag & SSH_FXE_STATVFS_ST_NOSUID) == 0; }
        }
        /// 
        /// Gets the max name lenght.
        /// 
        /// 
        /// The max name lenght.
        /// 
        public ulong MaxNameLenght { get; private set; }
        /// 
        /// Initializes a new instance of the  class.
        /// 
        /// The bsize.
        /// The frsize.
        /// The blocks.
        /// The bfree.
        /// The bavail.
        /// The files.
        /// The ffree.
        /// The favail.
        /// The sid.
        /// The flag.
        /// The namemax.
        internal SftpFileSytemInformation(ulong bsize, ulong frsize, ulong blocks, ulong bfree, ulong bavail, ulong files, ulong ffree, ulong favail, ulong sid, ulong flag, ulong namemax)
        {
            FileSystemBlockSize = bsize;
            BlockSize = frsize;
            TotalBlocks = blocks;
            FreeBlocks = bfree;
            AvailableBlocks = bavail;
            TotalNodes = files;
            FreeNodes = ffree;
            AvailableNodes = favail;
            Sid = sid;
            _flag = flag;
            MaxNameLenght = namemax;
        }
    }
}