// Generated by scripts/generate.mjs from bindings/api.mjs. Do not edit.

///|
#external
pub type AnimationClip

///|
#module("@mizchi/three-mbt/constructors")
pub extern "js" fn AnimationClip::AnimationClip(
  name : String,
  duration : Double,
  tracks : FixedArray[KeyframeTrack],
) -> AnimationClip = "animationClip"

///|
pub extern "js" fn AnimationClip::name(self : AnimationClip) -> String =
  #| (self) => self.name

///|
pub extern "js" fn AnimationClip::duration(self : AnimationClip) -> Double =
  #| (self) => self.duration

///|
pub extern "js" fn AnimationClip::tracks(
  self : AnimationClip,
) -> FixedArray[KeyframeTrack] =
  #| (self) => self.tracks.slice()

///|
pub extern "js" fn AnimationClip::clone(self : AnimationClip) -> AnimationClip =
  #| (self) => self.clone()

///|
pub extern "js" fn AnimationClip::optimize(
  self : AnimationClip,
) -> AnimationClip =
  #| (self) => self.optimize()

///|
pub extern "js" fn AnimationClip::validate(self : AnimationClip) -> Bool =
  #| (self) => self.validate()

///|
pub extern "js" fn AnimationClip::reset_duration(
  self : AnimationClip,
) -> AnimationClip =
  #| (self) => self.resetDuration()

///|
pub extern "js" fn AnimationClip::blend_mode(
  self : AnimationClip,
) -> AnimationBlendMode =
  #| (self) => self.blendMode

///|
pub extern "js" fn AnimationClip::set_blend_mode(
  self : AnimationClip,
  value : AnimationBlendMode,
) -> Unit =
  #| (self, value) => { self.blendMode = value; }

///|
pub extern "js" fn AnimationClip::uuid(self : AnimationClip) -> String =
  #| (self) => self.uuid

///|
pub extern "js" fn AnimationClip::user_data(self : AnimationClip) -> UserData =
  #| (self) => self.userData

///|
pub extern "js" fn AnimationClip::trim(self : AnimationClip) -> AnimationClip =
  #| (self) => self.trim()

///|
extern "js" fn AnimationClip::ffi_to_json(
  self : AnimationClip,
) -> JsResult[String] =
  #| (self) => { try { return { ok: true, value: (() => JSON.stringify(self.toJSON()))() }; } catch (error) { return { ok: false, error: String(error) }; } }

///|
pub fn AnimationClip::to_json(
  self : AnimationClip,
) -> Json raise SerializationError {
  match self.ffi_to_json().into_result() {
    Ok(value) =>
      @json.parse(value) catch {
        error => raise SerializationError((error : Error).to_string())
      }
    Err(message) => raise SerializationError(message)
  }
}

///|
extern "js" fn AnimationClip::ffi_to_json_string(
  self : AnimationClip,
) -> JsResult[String] =
  #| (self) => { try { return { ok: true, value: (() => JSON.stringify(self.toJSON()))() }; } catch (error) { return { ok: false, error: String(error) }; } }

///|
pub fn AnimationClip::to_json_string(
  self : AnimationClip,
) -> String raise SerializationError {
  match self.ffi_to_json_string().into_result() {
    Ok(value) => value
    Err(message) => raise SerializationError(message)
  }
}