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

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

extern crate flatbuffers;
use self::flatbuffers::EndianScalar;

#[allow(unused_imports, dead_code)]
#[rustfmt::skip]
pub mod flat_geobuf {

  use crate::header_generated::flat_geobuf::*;
  use std::mem;
  use std::cmp::Ordering;

  extern crate flatbuffers;
  use self::flatbuffers::EndianScalar;

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

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

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

impl<'a> Geometry<'a> {
    #[inline]
    pub 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()
    }

    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 fn ends(&self) -> Option<flatbuffers::Vector<'a, u32>> {
    self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u32>>>(Geometry::VT_ENDS, None)
  }
  #[inline]
  pub fn xy(&self) -> Option<flatbuffers::Vector<'a, f64>> {
    self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(Geometry::VT_XY, None)
  }
  #[inline]
  pub fn z(&self) -> Option<flatbuffers::Vector<'a, f64>> {
    self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(Geometry::VT_Z, None)
  }
  #[inline]
  pub fn m(&self) -> Option<flatbuffers::Vector<'a, f64>> {
    self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(Geometry::VT_M, None)
  }
  #[inline]
  pub fn t(&self) -> Option<flatbuffers::Vector<'a, f64>> {
    self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(Geometry::VT_T, None)
  }
  #[inline]
  pub fn tm(&self) -> Option<flatbuffers::Vector<'a, u64>> {
    self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(Geometry::VT_TM, None)
  }
  #[inline]
  pub fn type_(&self) -> GeometryType {
    self._tab.get::<GeometryType>(Geometry::VT_TYPE_, Some(GeometryType::Unknown)).unwrap()
  }
  #[inline]
  pub fn parts(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Geometry<'a>>>> {
    self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<flatbuffers::ForwardsUOffset<Geometry<'a>>>>>(Geometry::VT_PARTS, None)
  }
}

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())
  }
}

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

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

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

impl<'a> Feature<'a> {
    #[inline]
    pub 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()
    }

    pub const VT_GEOMETRY: flatbuffers::VOffsetT = 4;
    pub const VT_PROPERTIES: flatbuffers::VOffsetT = 6;
    pub const VT_COLUMNS: flatbuffers::VOffsetT = 8;

  #[inline]
  pub fn geometry(&self) -> Option<Geometry<'a>> {
    self._tab.get::<flatbuffers::ForwardsUOffset<Geometry<'a>>>(Feature::VT_GEOMETRY, None)
  }
  #[inline]
  pub fn properties(&self) -> Option<&'a [u8]> {
    self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Feature::VT_PROPERTIES, None).map(|v| v.safe_slice())
  }
  #[inline]
  pub fn columns(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Column<'a>>>> {
    self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<flatbuffers::ForwardsUOffset<Column<'a>>>>>(Feature::VT_COLUMNS, None)
  }
}

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())
  }
}

#[inline]
pub fn get_root_as_feature<'a>(buf: &'a [u8]) -> Feature<'a> {
  flatbuffers::get_root::<Feature<'a>>(buf)
}

#[inline]
pub fn get_size_prefixed_root_as_feature<'a>(buf: &'a [u8]) -> Feature<'a> {
  flatbuffers::get_size_prefixed_root::<Feature<'a>>(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);
}
} // pub mod FlatGeobuf
