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

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

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

impl<'a> HollowChallengeTemplate<'a> {
  pub const VT_ID: flatbuffers::VOffsetT = 4;
  pub const VT_HOLLOW_QUEST_ID: flatbuffers::VOffsetT = 6;
  pub const VT_UNK_1: flatbuffers::VOffsetT = 8;
  pub const VT_UNK_2: flatbuffers::VOffsetT = 10;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    HollowChallengeTemplate { _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 HollowChallengeTemplateArgs
  ) -> flatbuffers::WIPOffset<HollowChallengeTemplate<'bldr>> {
    let mut builder = HollowChallengeTemplateBuilder::new(_fbb);
    builder.add_hollow_quest_id(args.hollow_quest_id);
    builder.add_id(args.id);
    builder.add_unk_2(args.unk_2);
    builder.add_unk_1(args.unk_1);
    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>(HollowChallengeTemplate::VT_ID, Some(0)).unwrap()}
  }
  #[inline]
  pub fn hollow_quest_id(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(HollowChallengeTemplate::VT_HOLLOW_QUEST_ID, Some(0)).unwrap()}
  }
  #[inline]
  pub fn unk_1(&self) -> bool {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<bool>(HollowChallengeTemplate::VT_UNK_1, Some(false)).unwrap()}
  }
  #[inline]
  pub fn unk_2(&self) -> bool {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<bool>(HollowChallengeTemplate::VT_UNK_2, Some(false)).unwrap()}
  }
}

impl flatbuffers::Verifiable for HollowChallengeTemplate<'_> {
  #[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::<u32>("hollow_quest_id", Self::VT_HOLLOW_QUEST_ID, false)?
     .visit_field::<bool>("unk_1", Self::VT_UNK_1, false)?
     .visit_field::<bool>("unk_2", Self::VT_UNK_2, false)?
     .finish();
    Ok(())
  }
}
pub struct HollowChallengeTemplateArgs {
    pub id: u32,
    pub hollow_quest_id: u32,
    pub unk_1: bool,
    pub unk_2: bool,
}
impl<'a> Default for HollowChallengeTemplateArgs {
  #[inline]
  fn default() -> Self {
    HollowChallengeTemplateArgs {
      id: 0,
      hollow_quest_id: 0,
      unk_1: false,
      unk_2: false,
    }
  }
}

pub struct HollowChallengeTemplateBuilder<'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> HollowChallengeTemplateBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_id(&mut self, id: u32) {
    self.fbb_.push_slot::<u32>(HollowChallengeTemplate::VT_ID, id, 0);
  }
  #[inline]
  pub fn add_hollow_quest_id(&mut self, hollow_quest_id: u32) {
    self.fbb_.push_slot::<u32>(HollowChallengeTemplate::VT_HOLLOW_QUEST_ID, hollow_quest_id, 0);
  }
  #[inline]
  pub fn add_unk_1(&mut self, unk_1: bool) {
    self.fbb_.push_slot::<bool>(HollowChallengeTemplate::VT_UNK_1, unk_1, false);
  }
  #[inline]
  pub fn add_unk_2(&mut self, unk_2: bool) {
    self.fbb_.push_slot::<bool>(HollowChallengeTemplate::VT_UNK_2, unk_2, false);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> HollowChallengeTemplateBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    HollowChallengeTemplateBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<HollowChallengeTemplate<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

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

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

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

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

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

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

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

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