syntax = "proto3";
import "google/protobuf/any.proto";

enum PropertyId {
    BackendSpecific = 0;
    StreamIdProperty = 1;
    StreamsProperty = 2;
    TitleProperty = 3;
    FilenameProperty = 4;
    FilePathProperty = 5;
    PositionProperty = 6;
    SpecProperty = 7;
    BackendId = 8;
    BackendName = 9;
    PlaybackRate = 10;
    LengthProperty = 11;
    PriorityProperty = 12;
};
message StringProperty {
    string value = 506;
}
message DoubleProperty {
	double value = 1;
};
message BooleanProperty {
	bool value = 1;
};
message BytesProperty {
	bytes value = 1;
};
message IntProperty {
    int64 value = 1;
}
message PropertyHintRange {
	optional double min = 1;
	optional double max = 2;
};
message PropertyHintEnum {
	repeated string data = 1;
};
message PropertyHint {
	oneof hint {
		PropertyHintRange range = 1;
		fixed64 max_length = 2;
		PropertyHintEnum enum = 3;
	};
};
enum PropertyType {
	Double = 0;
	Boolean = 1;
	String = 2;
	Bytes = 3;
	StreamType = 4;
	AudioSpecType = 5;
	StreamID = 6;
    Int = 7;
}
message Property {
	PropertyType type = 1;
	optional PropertyId id = 5;
	optional string path = 2;
	optional string name = 4;
	optional PropertyHint hint = 3;
};
message StreamId {
    uint64 id = 504;
};
message Stream {
    uint64 id = 501;
    double len = 502;
    string title = 503;
};
message StreamList {
    repeated Stream streams = 500;
}
enum EndianID {
    LITTLE = 0;
    BIG = 1;
};
enum FormatType {
    UNSIGNED = 0;
    SIGNED = 1;
    FLOAT = 2;
};
message AudioSpec {
    uint32 channel_count = 509;
    EndianID endian = 510;
    FormatType format_type = 511;
    uint32 bits = 512;
    uint64 sample_rate = 513;
    optional uint64 min_samples = 514;
    optional uint64 max_samples = 515;
}
message PropertyData {
    PropertyId id = 100;
    optional uint64 idx = 108;
    google.protobuf.Any value = 101;
};
message GetProperty {
    PropertyId id = 102;
    optional string path = 107;
    optional uint64 idx = 103;
};
message SetProperty {
    PropertyId id = 104;
    optional string path = 109;
    optional uint64 idx = 105;
    google.protobuf.Any value = 106;
};
message ResetProperty {
    string path = 110;
    optional uint64 idx = 111;
};

message ErrorResponse {
    string id = 5000;
    optional string desc = 5001;
    bool fatal = 5002;
};

message PropertyDataOrError {
    oneof data {
        PropertyData output = 1;
        ErrorResponse err = 2;
    };
};
message ResetResponse {
    optional PropertyDataOrError value = 1;
}
message MaybeError {
    optional ErrorResponse err = 1;
};