package LasTres::Stats;

use v5.36.0;

use strict;
use warnings;

use feature 'signatures';

use Moo;

has health => (
    is       => 'rw',
    required => 1,
);

has mana => (
    is       => 'rw',
    required => 1,
);

has strength => (
    is       => 'rw',
    required => 1,
);

has resistance => (
    is       => 'rw',
    required => 1,
);

has magic => (
    is       => 'rw',
    required => 1,
);

has speed => (
    is       => 'rw',
    required => 1,
);

has intelligence => (
    is       => 'rw',
    required => 1,
);

sub to_hash ($self) {
    return {
        health       => $self->health,
        mana         => $self->mana,
        strength     => $self->strength,
        resistance   => $self->resistance,
        magic        => $self->magic,
        speed        => $self->speed,
        intelligence => $self->intelligence
    };
}

sub from_hash($class, $hash) {
    return $class->new(%$hash);
}
1;
