use v6.e.PREVIEW;

use JSON::Class:auth<zef:vrurg>;

#| A plain markdown post
unit class Series is json(:pretty);

#| The title of a series
has Str:D $.title is required;

#| The description of a series
has Str:D $.desc is required;

#| The ids of the posts in the series, in series order
has Int:D @.post-ids is rw = [];

#| Returns true if this series contains the given post id
method contains-post(Int:D $post-id --> Bool:D) {
    if $post-id ~~ any @!post-ids {
        True
    } else {
        False
    }
}