package LolCatalyst::Lite::SnippetStore;

use Moose;
use namespace::clean -except => 'meta';

has '_snippets' => (is => 'ro', default => sub { [] });

sub find {
  my ($self, $id) = @_;
  $self->_snippets->[$id - 1];
}

sub all {
  my ($self) = @_;
  @{$self->_snippets};
}

sub create {
  my ($self, $new) = @_;
  $new->{id} = @{$self->_snippets} + 1;
  push(@{$self->_snippets}, $new);
  $new;
}

__PACKAGE__->meta->make_immutable;

1;
