// 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 ConditionConfigTemplateOffset {}
#[derive(Copy, Clone, PartialEq)]

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

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

impl<'a> ConditionConfigTemplate<'a> {
  pub const VT_CONDITION_ID: flatbuffers::VOffsetT = 4;
  pub const VT_ARGS: flatbuffers::VOffsetT = 6;
  pub const VT_COMMENTARY: flatbuffers::VOffsetT = 8;
  pub const VT_UNK_2: flatbuffers::VOffsetT = 10;
  pub const VT_STATIS_TYPE: flatbuffers::VOffsetT = 12;
  pub const VT_TARGET_NUM: flatbuffers::VOffsetT = 14;
  pub const VT_TYPE_: flatbuffers::VOffsetT = 16;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    ConditionConfigTemplate { _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 ConditionConfigTemplateArgs<'args>
  ) -> flatbuffers::WIPOffset<ConditionConfigTemplate<'bldr>> {
    let mut builder = ConditionConfigTemplateBuilder::new(_fbb);
    builder.add_type_(args.type_);
    builder.add_target_num(args.target_num);
    builder.add_statis_type(args.statis_type);
    if let Some(x) = args.unk_2 { builder.add_unk_2(x); }
    if let Some(x) = args.commentary { builder.add_commentary(x); }
    if let Some(x) = args.args { builder.add_args(x); }
    builder.add_condition_id(args.condition_id);
    builder.finish()
  }


  #[inline]
  pub fn condition_id(&self) -> i32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<i32>(ConditionConfigTemplate::VT_CONDITION_ID, Some(0)).unwrap()}
  }
  #[inline]
  pub fn args(&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>>(ConditionConfigTemplate::VT_ARGS, None)}
  }
  #[inline]
  pub fn commentary(&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>>(ConditionConfigTemplate::VT_COMMENTARY, None)}
  }
  #[inline]
  pub fn unk_2(&self) -> Option<flatbuffers::Vector<'a, i32>> {
    // 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, i32>>>(ConditionConfigTemplate::VT_UNK_2, None)}
  }
  #[inline]
  pub fn statis_type(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(ConditionConfigTemplate::VT_STATIS_TYPE, Some(0)).unwrap()}
  }
  #[inline]
  pub fn target_num(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(ConditionConfigTemplate::VT_TARGET_NUM, Some(0)).unwrap()}
  }
  #[inline]
  pub fn type_(&self) -> i32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<i32>(ConditionConfigTemplate::VT_TYPE_, Some(0)).unwrap()}
  }
}

impl flatbuffers::Verifiable for ConditionConfigTemplate<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<i32>("condition_id", Self::VT_CONDITION_ID, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("args", Self::VT_ARGS, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("commentary", Self::VT_COMMENTARY, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, i32>>>("unk_2", Self::VT_UNK_2, false)?
     .visit_field::<u32>("statis_type", Self::VT_STATIS_TYPE, false)?
     .visit_field::<u32>("target_num", Self::VT_TARGET_NUM, false)?
     .visit_field::<i32>("type_", Self::VT_TYPE_, false)?
     .finish();
    Ok(())
  }
}
pub struct ConditionConfigTemplateArgs<'a> {
    pub condition_id: i32,
    pub args: Option<flatbuffers::WIPOffset<&'a str>>,
    pub commentary: Option<flatbuffers::WIPOffset<&'a str>>,
    pub unk_2: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, i32>>>,
    pub statis_type: u32,
    pub target_num: u32,
    pub type_: i32,
}
impl<'a> Default for ConditionConfigTemplateArgs<'a> {
  #[inline]
  fn default() -> Self {
    ConditionConfigTemplateArgs {
      condition_id: 0,
      args: None,
      commentary: None,
      unk_2: None,
      statis_type: 0,
      target_num: 0,
      type_: 0,
    }
  }
}

pub struct ConditionConfigTemplateBuilder<'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> ConditionConfigTemplateBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_condition_id(&mut self, condition_id: i32) {
    self.fbb_.push_slot::<i32>(ConditionConfigTemplate::VT_CONDITION_ID, condition_id, 0);
  }
  #[inline]
  pub fn add_args(&mut self, args: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(ConditionConfigTemplate::VT_ARGS, args);
  }
  #[inline]
  pub fn add_commentary(&mut self, commentary: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(ConditionConfigTemplate::VT_COMMENTARY, commentary);
  }
  #[inline]
  pub fn add_unk_2(&mut self, unk_2: flatbuffers::WIPOffset<flatbuffers::Vector<'b , i32>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(ConditionConfigTemplate::VT_UNK_2, unk_2);
  }
  #[inline]
  pub fn add_statis_type(&mut self, statis_type: u32) {
    self.fbb_.push_slot::<u32>(ConditionConfigTemplate::VT_STATIS_TYPE, statis_type, 0);
  }
  #[inline]
  pub fn add_target_num(&mut self, target_num: u32) {
    self.fbb_.push_slot::<u32>(ConditionConfigTemplate::VT_TARGET_NUM, target_num, 0);
  }
  #[inline]
  pub fn add_type_(&mut self, type_: i32) {
    self.fbb_.push_slot::<i32>(ConditionConfigTemplate::VT_TYPE_, type_, 0);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ConditionConfigTemplateBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    ConditionConfigTemplateBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<ConditionConfigTemplate<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for ConditionConfigTemplate<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("ConditionConfigTemplate");
      ds.field("condition_id", &self.condition_id());
      ds.field("args", &self.args());
      ds.field("commentary", &self.commentary());
      ds.field("unk_2", &self.unk_2());
      ds.field("statis_type", &self.statis_type());
      ds.field("target_num", &self.target_num());
      ds.field("type_", &self.type_());
      ds.finish()
  }
}
pub enum ConditionConfigTemplateTbOffset {}
#[derive(Copy, Clone, PartialEq)]

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

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

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

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    ConditionConfigTemplateTb { _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 ConditionConfigTemplateTbArgs<'args>
  ) -> flatbuffers::WIPOffset<ConditionConfigTemplateTb<'bldr>> {
    let mut builder = ConditionConfigTemplateTbBuilder::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<ConditionConfigTemplate<'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<ConditionConfigTemplate>>>>(ConditionConfigTemplateTb::VT_DATA, None)}
  }
}

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

pub struct ConditionConfigTemplateTbBuilder<'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> ConditionConfigTemplateTbBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_data(&mut self, data: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<ConditionConfigTemplate<'b >>>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(ConditionConfigTemplateTb::VT_DATA, data);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ConditionConfigTemplateTbBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    ConditionConfigTemplateTbBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<ConditionConfigTemplateTb<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

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