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

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

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

impl<'a> TraningQuestTemplate<'a> {
  pub const VT_ID: flatbuffers::VOffsetT = 4;
  pub const VT_TRAINING_TYPE: flatbuffers::VOffsetT = 6;
  pub const VT_BATTLE_EVENT_ID: flatbuffers::VOffsetT = 8;
  pub const VT_SPECIAL_TRAINING_NAME: flatbuffers::VOffsetT = 10;
  pub const VT_SPECIAL_TRAINING_ID: flatbuffers::VOffsetT = 12;
  pub const VT_UNK_1: flatbuffers::VOffsetT = 14;
  pub const VT_UNK_2: flatbuffers::VOffsetT = 16;
  pub const VT_UNK_3: flatbuffers::VOffsetT = 18;
  pub const VT_UNK_4: flatbuffers::VOffsetT = 20;
  pub const VT_UNK_5: flatbuffers::VOffsetT = 22;
  pub const VT_UNK_6: flatbuffers::VOffsetT = 24;
  pub const VT_UNK_7: flatbuffers::VOffsetT = 26;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    TraningQuestTemplate { _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 TraningQuestTemplateArgs<'args>
  ) -> flatbuffers::WIPOffset<TraningQuestTemplate<'bldr>> {
    let mut builder = TraningQuestTemplateBuilder::new(_fbb);
    if let Some(x) = args.unk_7 { builder.add_unk_7(x); }
    if let Some(x) = args.unk_6 { builder.add_unk_6(x); }
    builder.add_unk_3(args.unk_3);
    builder.add_unk_2(args.unk_2);
    builder.add_unk_1(args.unk_1);
    builder.add_special_training_id(args.special_training_id);
    if let Some(x) = args.special_training_name { builder.add_special_training_name(x); }
    builder.add_battle_event_id(args.battle_event_id);
    builder.add_training_type(args.training_type);
    builder.add_id(args.id);
    builder.add_unk_5(args.unk_5);
    builder.add_unk_4(args.unk_4);
    builder.finish()
  }


  #[inline]
  pub fn id(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(TraningQuestTemplate::VT_ID, Some(0)).unwrap()}
  }
  #[inline]
  pub fn training_type(&self) -> i32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<i32>(TraningQuestTemplate::VT_TRAINING_TYPE, Some(0)).unwrap()}
  }
  #[inline]
  pub fn battle_event_id(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(TraningQuestTemplate::VT_BATTLE_EVENT_ID, Some(0)).unwrap()}
  }
  #[inline]
  pub fn special_training_name(&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>>(TraningQuestTemplate::VT_SPECIAL_TRAINING_NAME, None)}
  }
  #[inline]
  pub fn special_training_id(&self) -> i32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<i32>(TraningQuestTemplate::VT_SPECIAL_TRAINING_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>(TraningQuestTemplate::VT_UNK_1, Some(0)).unwrap()}
  }
  #[inline]
  pub fn unk_2(&self) -> i32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<i32>(TraningQuestTemplate::VT_UNK_2, Some(0)).unwrap()}
  }
  #[inline]
  pub fn unk_3(&self) -> i32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<i32>(TraningQuestTemplate::VT_UNK_3, Some(0)).unwrap()}
  }
  #[inline]
  pub fn unk_4(&self) -> bool {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<bool>(TraningQuestTemplate::VT_UNK_4, Some(false)).unwrap()}
  }
  #[inline]
  pub fn unk_5(&self) -> bool {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<bool>(TraningQuestTemplate::VT_UNK_5, Some(false)).unwrap()}
  }
  #[inline]
  pub fn unk_6(&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>>(TraningQuestTemplate::VT_UNK_6, None)}
  }
  #[inline]
  pub fn unk_7(&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>>(TraningQuestTemplate::VT_UNK_7, None)}
  }
}

impl flatbuffers::Verifiable for TraningQuestTemplate<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<u32>("id", Self::VT_ID, false)?
     .visit_field::<i32>("training_type", Self::VT_TRAINING_TYPE, false)?
     .visit_field::<u32>("battle_event_id", Self::VT_BATTLE_EVENT_ID, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("special_training_name", Self::VT_SPECIAL_TRAINING_NAME, false)?
     .visit_field::<i32>("special_training_id", Self::VT_SPECIAL_TRAINING_ID, false)?
     .visit_field::<i32>("unk_1", Self::VT_UNK_1, false)?
     .visit_field::<i32>("unk_2", Self::VT_UNK_2, false)?
     .visit_field::<i32>("unk_3", Self::VT_UNK_3, false)?
     .visit_field::<bool>("unk_4", Self::VT_UNK_4, false)?
     .visit_field::<bool>("unk_5", Self::VT_UNK_5, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("unk_6", Self::VT_UNK_6, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("unk_7", Self::VT_UNK_7, false)?
     .finish();
    Ok(())
  }
}
pub struct TraningQuestTemplateArgs<'a> {
    pub id: u32,
    pub training_type: i32,
    pub battle_event_id: u32,
    pub special_training_name: Option<flatbuffers::WIPOffset<&'a str>>,
    pub special_training_id: i32,
    pub unk_1: i32,
    pub unk_2: i32,
    pub unk_3: i32,
    pub unk_4: bool,
    pub unk_5: bool,
    pub unk_6: Option<flatbuffers::WIPOffset<&'a str>>,
    pub unk_7: Option<flatbuffers::WIPOffset<&'a str>>,
}
impl<'a> Default for TraningQuestTemplateArgs<'a> {
  #[inline]
  fn default() -> Self {
    TraningQuestTemplateArgs {
      id: 0,
      training_type: 0,
      battle_event_id: 0,
      special_training_name: None,
      special_training_id: 0,
      unk_1: 0,
      unk_2: 0,
      unk_3: 0,
      unk_4: false,
      unk_5: false,
      unk_6: None,
      unk_7: None,
    }
  }
}

pub struct TraningQuestTemplateBuilder<'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> TraningQuestTemplateBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_id(&mut self, id: u32) {
    self.fbb_.push_slot::<u32>(TraningQuestTemplate::VT_ID, id, 0);
  }
  #[inline]
  pub fn add_training_type(&mut self, training_type: i32) {
    self.fbb_.push_slot::<i32>(TraningQuestTemplate::VT_TRAINING_TYPE, training_type, 0);
  }
  #[inline]
  pub fn add_battle_event_id(&mut self, battle_event_id: u32) {
    self.fbb_.push_slot::<u32>(TraningQuestTemplate::VT_BATTLE_EVENT_ID, battle_event_id, 0);
  }
  #[inline]
  pub fn add_special_training_name(&mut self, special_training_name: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(TraningQuestTemplate::VT_SPECIAL_TRAINING_NAME, special_training_name);
  }
  #[inline]
  pub fn add_special_training_id(&mut self, special_training_id: i32) {
    self.fbb_.push_slot::<i32>(TraningQuestTemplate::VT_SPECIAL_TRAINING_ID, special_training_id, 0);
  }
  #[inline]
  pub fn add_unk_1(&mut self, unk_1: i32) {
    self.fbb_.push_slot::<i32>(TraningQuestTemplate::VT_UNK_1, unk_1, 0);
  }
  #[inline]
  pub fn add_unk_2(&mut self, unk_2: i32) {
    self.fbb_.push_slot::<i32>(TraningQuestTemplate::VT_UNK_2, unk_2, 0);
  }
  #[inline]
  pub fn add_unk_3(&mut self, unk_3: i32) {
    self.fbb_.push_slot::<i32>(TraningQuestTemplate::VT_UNK_3, unk_3, 0);
  }
  #[inline]
  pub fn add_unk_4(&mut self, unk_4: bool) {
    self.fbb_.push_slot::<bool>(TraningQuestTemplate::VT_UNK_4, unk_4, false);
  }
  #[inline]
  pub fn add_unk_5(&mut self, unk_5: bool) {
    self.fbb_.push_slot::<bool>(TraningQuestTemplate::VT_UNK_5, unk_5, false);
  }
  #[inline]
  pub fn add_unk_6(&mut self, unk_6: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(TraningQuestTemplate::VT_UNK_6, unk_6);
  }
  #[inline]
  pub fn add_unk_7(&mut self, unk_7: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(TraningQuestTemplate::VT_UNK_7, unk_7);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TraningQuestTemplateBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    TraningQuestTemplateBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<TraningQuestTemplate<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for TraningQuestTemplate<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("TraningQuestTemplate");
      ds.field("id", &self.id());
      ds.field("training_type", &self.training_type());
      ds.field("battle_event_id", &self.battle_event_id());
      ds.field("special_training_name", &self.special_training_name());
      ds.field("special_training_id", &self.special_training_id());
      ds.field("unk_1", &self.unk_1());
      ds.field("unk_2", &self.unk_2());
      ds.field("unk_3", &self.unk_3());
      ds.field("unk_4", &self.unk_4());
      ds.field("unk_5", &self.unk_5());
      ds.field("unk_6", &self.unk_6());
      ds.field("unk_7", &self.unk_7());
      ds.finish()
  }
}
pub enum TraningQuestTemplateTbOffset {}
#[derive(Copy, Clone, PartialEq)]

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

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

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

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

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

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

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