using System;

namespace Crysome.Common.Model;

public class FileSystemEntry
{
	public string Name { get; set; }

	public string Path { get; set; }

	public long Size { get; set; }

	public FileType Type { get; set; }

	public long LastWriteUtcTicks { get; set; }

	public byte[] IconPng { get; set; }

	public DateTime LastWriteUtc
	{
		get
		{
			if (LastWriteUtcTicks <= 0)
			{
				return DateTime.MinValue;
			}
			return new DateTime(LastWriteUtcTicks, DateTimeKind.Utc);
		}
	}

	public string ModifiedDisplay
	{
		get
		{
			if (LastWriteUtcTicks <= 0)
			{
				return "";
			}
			return new DateTime(LastWriteUtcTicks, DateTimeKind.Utc).ToLocalTime().ToString("yyyy-MM-dd HH:mm");
		}
	}

	public FileSystemEntry(string name, string path, long size, FileType type, long lastWriteUtcTicks = 0L, byte[] iconPng = null)
	{
		Name = name;
		Path = path;
		Size = size;
		Type = type;
		LastWriteUtcTicks = lastWriteUtcTicks;
		IconPng = iconPng;
	}
}
