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


// @generated

use core::mem;
use core::cmp::Ordering;

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

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

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

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

impl<'a> NewbieGroupTemplate<'a> {
  pub const VT_ID: flatbuffers::VOffsetT = 4;
  pub const VT_UNK_1: flatbuffers::VOffsetT = 6;
  pub const VT_TRIGGER_CONDITION: flatbuffers::VOffsetT = 8;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    NewbieGroupTemplate { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
    args: &'args NewbieGroupTemplateArgs<'args>
  ) -> flatbuffers::WIPOffset<NewbieGroupTemplate<'bldr>> {
    let mut builder = NewbieGroupTemplateBuilder::new(_fbb);
    if let Some(x) = args.trigger_condition { builder.add_trigger_condition(x); }
    builder.add_unk_1(args.unk_1);
    builder.add_id(args.id);
    builder.finish()
  }


  #[inline]
  pub fn id(&self) -> i32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<i32>(NewbieGroupTemplate::VT_ID, Some(0)).unwrap()}
  }
  #[inline]
  pub fn unk_1(&self) -> i32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<i32>(NewbieGroupTemplate::VT_UNK_1, Some(0)).unwrap()}
  }
  #[inline]
  pub fn trigger_condition(&self) -> Option<&'a str> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(NewbieGroupTemplate::VT_TRIGGER_CONDITION, None)}
  }
}

impl flatbuffers::Verifiable for NewbieGroupTemplate<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<i32>("id", Self::VT_ID, false)?
     .visit_field::<i32>("unk_1", Self::VT_UNK_1, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("trigger_condition", Self::VT_TRIGGER_CONDITION, false)?
     .finish();
    Ok(())
  }
}
pub struct NewbieGroupTemplateArgs<'a> {
    pub id: i32,
    pub unk_1: i32,
    pub trigger_condition: Option<flatbuffers::WIPOffset<&'a str>>,
}
impl<'a> Default for NewbieGroupTemplateArgs<'a> {
  #[inline]
  fn default() -> Self {
    NewbieGroupTemplateArgs {
      id: 0,
      unk_1: 0,
      trigger_condition: None,
    }
  }
}

pub struct NewbieGroupTemplateBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> NewbieGroupTemplateBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_id(&mut self, id: i32) {
    self.fbb_.push_slot::<i32>(NewbieGroupTemplate::VT_ID, id, 0);
  }
  #[inline]
  pub fn add_unk_1(&mut self, unk_1: i32) {
    self.fbb_.push_slot::<i32>(NewbieGroupTemplate::VT_UNK_1, unk_1, 0);
  }
  #[inline]
  pub fn add_trigger_condition(&mut self, trigger_condition: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(NewbieGroupTemplate::VT_TRIGGER_CONDITION, trigger_condition);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> NewbieGroupTemplateBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    NewbieGroupTemplateBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<NewbieGroupTemplate<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for NewbieGroupTemplate<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("NewbieGroupTemplate");
      ds.field("id", &self.id());
      ds.field("unk_1", &self.unk_1());
      ds.field("trigger_condition", &self.trigger_condition());
      ds.finish()
  }
}
pub enum NewbieGroupTemplateTbOffset {}
#[derive(Copy, Clone, PartialEq)]

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

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

impl<'a> NewbieGroupTemplateTb<'a> {
  pub const VT_DATA: flatbuffers::VOffsetT = 4;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    NewbieGroupTemplateTb { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
    args: &'args NewbieGroupTemplateTbArgs<'args>
  ) -> flatbuffers::WIPOffset<NewbieGroupTemplateTb<'bldr>> {
    let mut builder = NewbieGroupTemplateTbBuilder::new(_fbb);
    if let Some(x) = args.data { builder.add_data(x); }
    builder.finish()
  }


  #[inline]
  pub fn data(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<NewbieGroupTemplate<'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<NewbieGroupTemplate>>>>(NewbieGroupTemplateTb::VT_DATA, None)}
  }
}

impl flatbuffers::Verifiable for NewbieGroupTemplateTb<'_> {
  #[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<'_, flatbuffers::ForwardsUOffset<NewbieGroupTemplate>>>>("data", Self::VT_DATA, false)?
     .finish();
    Ok(())
  }
}
pub struct NewbieGroupTemplateTbArgs<'a> {
    pub data: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<NewbieGroupTemplate<'a>>>>>,
}
impl<'a> Default for NewbieGroupTemplateTbArgs<'a> {
  #[inline]
  fn default() -> Self {
    NewbieGroupTemplateTbArgs {
      data: None,
    }
  }
}

pub struct NewbieGroupTemplateTbBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> NewbieGroupTemplateTbBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_data(&mut self, data: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<NewbieGroupTemplate<'b >>>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(NewbieGroupTemplateTb::VT_DATA, data);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> NewbieGroupTemplateTbBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    NewbieGroupTemplateTbBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<NewbieGroupTemplateTb<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for NewbieGroupTemplateTb<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("NewbieGroupTemplateTb");
      ds.field("data", &self.data());
      ds.finish()
  }
}
