// automatically generated by the FlatBuffers compiler, do not modify


// @generated

use crate::header_generated::*;
use core::mem;
use core::cmp::Ordering;

extern crate flatbuffers;
use self::flatbuffers::{EndianScalar, Follow};

pub enum GeometryOffset {}
#[derive(Copy, Clone, PartialEq)]

pub struct Geometry<'a> {
  pub _tab: flatbuffers::Table<'a>,
}

impl<'a> flatbuffers::Follow<'a> for Geometry<'a> {
  type Inner = Geometry<'a>;
  #[inline]
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    Self { _tab: flatbuffers::Table::new(buf, loc) }
  }
}

impl<'a> Geometry<'a> {
  pub const VT_ENDS: flatbuffers::VOffsetT = 4;
  pub const VT_XY: flatbuffers::VOffsetT = 6;
  pub const VT_Z: flatbuffers::VOffsetT = 8;
  pub const VT_M: flatbuffers::VOffsetT = 10;
  pub const VT_T: flatbuffers::VOffsetT = 12;
  pub const VT_TM: flatbuffers::VOffsetT = 14;
  pub const VT_TYPE_: flatbuffers::VOffsetT = 16;
  pub const VT_PARTS: flatbuffers::VOffsetT = 18;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    Geometry { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
    args: &'args GeometryArgs<'args>
  ) -> flatbuffers::WIPOffset<Geometry<'bldr>> {
    let mut builder = GeometryBuilder::new(_fbb);
    if let Some(x) = args.parts { builder.add_parts(x); }
    if let Some(x) = args.tm { builder.add_tm(x); }
    if let Some(x) = args.t { builder.add_t(x); }
    if let Some(x) = args.m { builder.add_m(x); }
    if let Some(x) = args.z { builder.add_z(x); }
    if let Some(x) = args.xy { builder.add_xy(x); }
    if let Some(x) = args.ends { builder.add_ends(x); }
    builder.add_type_(args.type_);
    builder.finish()
  }


  #[inline]
  pub fn ends(&self) -> Option<flatbuffers::Vector<'a, u32>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u32>>>(Geometry::VT_ENDS, None)}
  }
  #[inline]
  pub fn xy(&self) -> Option<flatbuffers::Vector<'a, f64>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(Geometry::VT_XY, None)}
  }
  #[inline]
  pub fn z(&self) -> Option<flatbuffers::Vector<'a, f64>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(Geometry::VT_Z, None)}
  }
  #[inline]
  pub fn m(&self) -> Option<flatbuffers::Vector<'a, f64>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(Geometry::VT_M, None)}
  }
  #[inline]
  pub fn t(&self) -> Option<flatbuffers::Vector<'a, f64>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(Geometry::VT_T, None)}
  }
  #[inline]
  pub fn tm(&self) -> Option<flatbuffers::Vector<'a, u64>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(Geometry::VT_TM, None)}
  }
  #[inline]
  pub fn type_(&self) -> GeometryType {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<GeometryType>(Geometry::VT_TYPE_, Some(GeometryType::Unknown)).unwrap()}
  }
  #[inline]
  pub fn parts(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Geometry<'a>>>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Geometry>>>>(Geometry::VT_PARTS, None)}
  }
}

impl flatbuffers::Verifiable for Geometry<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u32>>>("ends", Self::VT_ENDS, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, f64>>>("xy", Self::VT_XY, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, f64>>>("z", Self::VT_Z, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, f64>>>("m", Self::VT_M, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, f64>>>("t", Self::VT_T, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u64>>>("tm", Self::VT_TM, false)?
     .visit_field::<GeometryType>("type_", Self::VT_TYPE_, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Geometry>>>>("parts", Self::VT_PARTS, false)?
     .finish();
    Ok(())
  }
}
pub struct GeometryArgs<'a> {
    pub ends: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u32>>>,
    pub xy: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f64>>>,
    pub z: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f64>>>,
    pub m: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f64>>>,
    pub t: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f64>>>,
    pub tm: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u64>>>,
    pub type_: GeometryType,
    pub parts: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Geometry<'a>>>>>,
}
impl<'a> Default for GeometryArgs<'a> {
  #[inline]
  fn default() -> Self {
    GeometryArgs {
      ends: None,
      xy: None,
      z: None,
      m: None,
      t: None,
      tm: None,
      type_: GeometryType::Unknown,
      parts: None,
    }
  }
}

pub struct GeometryBuilder<'a: 'b, 'b> {
  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> GeometryBuilder<'a, 'b> {
  #[inline]
  pub fn add_ends(&mut self, ends: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u32>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Geometry::VT_ENDS, ends);
  }
  #[inline]
  pub fn add_xy(&mut self, xy: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Geometry::VT_XY, xy);
  }
  #[inline]
  pub fn add_z(&mut self, z: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Geometry::VT_Z, z);
  }
  #[inline]
  pub fn add_m(&mut self, m: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Geometry::VT_M, m);
  }
  #[inline]
  pub fn add_t(&mut self, t: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Geometry::VT_T, t);
  }
  #[inline]
  pub fn add_tm(&mut self, tm: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Geometry::VT_TM, tm);
  }
  #[inline]
  pub fn add_type_(&mut self, type_: GeometryType) {
    self.fbb_.push_slot::<GeometryType>(Geometry::VT_TYPE_, type_, GeometryType::Unknown);
  }
  #[inline]
  pub fn add_parts(&mut self, parts: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Geometry<'b >>>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Geometry::VT_PARTS, parts);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> GeometryBuilder<'a, 'b> {
    let start = _fbb.start_table();
    GeometryBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<Geometry<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for Geometry<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("Geometry");
      ds.field("ends", &self.ends());
      ds.field("xy", &self.xy());
      ds.field("z", &self.z());
      ds.field("m", &self.m());
      ds.field("t", &self.t());
      ds.field("tm", &self.tm());
      ds.field("type_", &self.type_());
      ds.field("parts", &self.parts());
      ds.finish()
  }
}
pub enum FeatureOffset {}
#[derive(Copy, Clone, PartialEq)]

pub struct Feature<'a> {
  pub _tab: flatbuffers::Table<'a>,
}

impl<'a> flatbuffers::Follow<'a> for Feature<'a> {
  type Inner = Feature<'a>;
  #[inline]
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    Self { _tab: flatbuffers::Table::new(buf, loc) }
  }
}

impl<'a> Feature<'a> {
  pub const VT_GEOMETRY: flatbuffers::VOffsetT = 4;
  pub const VT_PROPERTIES: flatbuffers::VOffsetT = 6;
  pub const VT_COLUMNS: flatbuffers::VOffsetT = 8;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    Feature { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
    args: &'args FeatureArgs<'args>
  ) -> flatbuffers::WIPOffset<Feature<'bldr>> {
    let mut builder = FeatureBuilder::new(_fbb);
    if let Some(x) = args.columns { builder.add_columns(x); }
    if let Some(x) = args.properties { builder.add_properties(x); }
    if let Some(x) = args.geometry { builder.add_geometry(x); }
    builder.finish()
  }


  #[inline]
  pub fn geometry(&self) -> Option<Geometry<'a>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<Geometry>>(Feature::VT_GEOMETRY, None)}
  }
  #[inline]
  pub fn properties(&self) -> Option<flatbuffers::Vector<'a, u8>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Feature::VT_PROPERTIES, None)}
  }
  #[inline]
  pub fn columns(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Column<'a>>>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Column>>>>(Feature::VT_COLUMNS, None)}
  }
}

impl flatbuffers::Verifiable for Feature<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<flatbuffers::ForwardsUOffset<Geometry>>("geometry", Self::VT_GEOMETRY, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>("properties", Self::VT_PROPERTIES, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Column>>>>("columns", Self::VT_COLUMNS, false)?
     .finish();
    Ok(())
  }
}
pub struct FeatureArgs<'a> {
    pub geometry: Option<flatbuffers::WIPOffset<Geometry<'a>>>,
    pub properties: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
    pub columns: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Column<'a>>>>>,
}
impl<'a> Default for FeatureArgs<'a> {
  #[inline]
  fn default() -> Self {
    FeatureArgs {
      geometry: None,
      properties: None,
      columns: None,
    }
  }
}

pub struct FeatureBuilder<'a: 'b, 'b> {
  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> FeatureBuilder<'a, 'b> {
  #[inline]
  pub fn add_geometry(&mut self, geometry: flatbuffers::WIPOffset<Geometry<'b >>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<Geometry>>(Feature::VT_GEOMETRY, geometry);
  }
  #[inline]
  pub fn add_properties(&mut self, properties: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Feature::VT_PROPERTIES, properties);
  }
  #[inline]
  pub fn add_columns(&mut self, columns: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Column<'b >>>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Feature::VT_COLUMNS, columns);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> FeatureBuilder<'a, 'b> {
    let start = _fbb.start_table();
    FeatureBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<Feature<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for Feature<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("Feature");
      ds.field("geometry", &self.geometry());
      ds.field("properties", &self.properties());
      ds.field("columns", &self.columns());
      ds.finish()
  }
}
#[inline]
/// Verifies that a buffer of bytes contains a `Feature`
/// and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_feature_unchecked`.
pub fn root_as_feature(buf: &[u8]) -> Result<Feature, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::root::<Feature>(buf)
}
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed
/// `Feature` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `size_prefixed_root_as_feature_unchecked`.
pub fn size_prefixed_root_as_feature(buf: &[u8]) -> Result<Feature, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::size_prefixed_root::<Feature>(buf)
}
#[inline]
/// Verifies, with the given options, that a buffer of bytes
/// contains a `Feature` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_feature_unchecked`.
pub fn root_as_feature_with_opts<'b, 'o>(
  opts: &'o flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<Feature<'b>, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::root_with_opts::<Feature<'b>>(opts, buf)
}
#[inline]
/// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `Feature` and returns
/// it. Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_feature_unchecked`.
pub fn size_prefixed_root_as_feature_with_opts<'b, 'o>(
  opts: &'o flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<Feature<'b>, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::size_prefixed_root_with_opts::<Feature<'b>>(opts, buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a Feature and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `Feature`.
pub unsafe fn root_as_feature_unchecked(buf: &[u8]) -> Feature {
  flatbuffers::root_unchecked::<Feature>(buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed Feature and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `Feature`.
pub unsafe fn size_prefixed_root_as_feature_unchecked(buf: &[u8]) -> Feature {
  flatbuffers::size_prefixed_root_unchecked::<Feature>(buf)
}
#[inline]
pub fn finish_feature_buffer<'a, 'b>(
    fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
    root: flatbuffers::WIPOffset<Feature<'a>>) {
  fbb.finish(root, None);
}

#[inline]
pub fn finish_size_prefixed_feature_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset<Feature<'a>>) {
  fbb.finish_size_prefixed(root, None);
}
