syntax = "proto2";

package ipfs.boxo.ipld.unixfs.pb;

option go_package = "github.com/ipfs/boxo/ipld/unixfs/pb";

message Data {
	enum DataType {
		Raw = 0;
		Directory = 1;
		File = 2;
		Metadata = 3;
		Symlink = 4;
		HAMTShard = 5;
	}

	required DataType Type = 1;
	optional bytes Data = 2;
	optional uint64 filesize = 3;
	repeated uint64 blocksizes = 4;

	optional uint64 hashType = 5;
	optional uint64 fanout = 6;
    optional uint32 mode = 7;
	optional IPFSTimestamp mtime = 8;
}

message Metadata {
	optional string MimeType = 1;
}

// mostly copied from proto 3 - with int32 nanos changed to fixed32 for js-ipfs compatibility
// https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/timestamp.proto
message IPFSTimestamp {
	// Represents seconds of UTC time since Unix epoch
	// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
	// 9999-12-31T23:59:59Z inclusive.
	required int64 seconds = 1;

	// Non-negative fractions of a second at nanosecond resolution. Negative
	// second values with fractions must still have non-negative nanos values
	// that count forward in time. Must be from 0 to 999,999,999
	// inclusive.
	optional fixed32 nanos = 2;
}
