import { CustomType as $CustomType } from "./gleam.mjs";

export class Vec2 extends $CustomType {
  constructor(x, y) {
    super();
    this.x = x;
    this.y = y;
  }
}
export const Vec2$Vec2 = (x, y) => new Vec2(x, y);
export const Vec2$isVec2 = (value) => value instanceof Vec2;
export const Vec2$Vec2$x = (value) => value.x;
export const Vec2$Vec2$0 = (value) => value.x;
export const Vec2$Vec2$y = (value) => value.y;
export const Vec2$Vec2$1 = (value) => value.y;

export class RigidBody extends $CustomType {
  constructor(velocity, acceleration, rotation, rotation_velocity) {
    super();
    this.velocity = velocity;
    this.acceleration = acceleration;
    this.rotation = rotation;
    this.rotation_velocity = rotation_velocity;
  }
}
export const RigidBody$RigidBody = (velocity, acceleration, rotation, rotation_velocity) =>
  new RigidBody(velocity, acceleration, rotation, rotation_velocity);
export const RigidBody$isRigidBody = (value) => value instanceof RigidBody;
export const RigidBody$RigidBody$velocity = (value) => value.velocity;
export const RigidBody$RigidBody$0 = (value) => value.velocity;
export const RigidBody$RigidBody$acceleration = (value) => value.acceleration;
export const RigidBody$RigidBody$1 = (value) => value.acceleration;
export const RigidBody$RigidBody$rotation = (value) => value.rotation;
export const RigidBody$RigidBody$2 = (value) => value.rotation;
export const RigidBody$RigidBody$rotation_velocity = (value) =>
  value.rotation_velocity;
export const RigidBody$RigidBody$3 = (value) => value.rotation_velocity;

export class Gravity extends $CustomType {
  constructor(acceleration) {
    super();
    this.acceleration = acceleration;
  }
}
export const Gravity$Gravity = (acceleration) => new Gravity(acceleration);
export const Gravity$isGravity = (value) => value instanceof Gravity;
export const Gravity$Gravity$acceleration = (value) => value.acceleration;
export const Gravity$Gravity$0 = (value) => value.acceleration;

export class Physics extends $CustomType {
  constructor(gravity) {
    super();
    this.gravity = gravity;
  }
}
export const Physics$Physics = (gravity) => new Physics(gravity);
export const Physics$isPhysics = (value) => value instanceof Physics;
export const Physics$Physics$gravity = (value) => value.gravity;
export const Physics$Physics$0 = (value) => value.gravity;

export function add_vec2(v1, v2) {
  return new Vec2(v1.x + v2.x, v1.y + v2.y);
}
