
namespace sigmf.core;

table sigmf_extension {
    name:string;
    version:string;
    optional:bool=null;
}

table sigmf_stream {
    name:string;
    hash:string;
}

table geojson_point {
    type:string;
    coordinates:[double];
}

table Global {
    datatype:string;
    sample_rate:double=null;
    version:string;
    num_channels:ulong=null;
    sha512:string;
    offset:ulong=null;
    description:string;
    author:string;
    meta_doi:string;
    data_doi:string;
    recorder:string;
    license:string;
    hw:string;
    dataset:string;
    trailing_bytes:ulong=null;
    metadata_only:bool=null;
    geolocation:geojson_point;
    extensions:[sigmf_extension];
    collection:string;
}

table Capture {
    sample_start:ulong=null;
    global_index:ulong=null;
    header_bytes:ulong=null;
    frequency:double=null;
    datetime:string;
}

table Annotation {
    sample_start:ulong=null;
    sample_count:ulong=null;
    generator:string;
    description:string; // not defined by SigMF; included for compatibility - use `label`
    label:string;
    comment:string;
    freq_lower_edge:double=null;
    freq_upper_edge:double=null;
    latitude:double=null;  // deprecated, use the `global` `geolocation` field
    longitude:double=null; // deprecated, use the `global` `geolocation` field
}

table Collection {
    version:string;
    description:string;
    author:string;
    collection_doi:string;
    license:string;
    extensions:[sigmf_extension];
    streams:[sigmf_stream];
}

table Descr {
    global:Global;
    annotation:Annotation;
    capture:Capture;
    collection:Collection;
}
