use strict;
use warnings;

package Liberl::Model::Library;
use Jifty::DBI::Schema;

use Liberl::Record schema {
    column name =>
        label is _('Name'),
        type is 'text';
    column place =>
        label is _('Place'),
        type is 'text';
    column owner =>
        references Liberl::Model::User;
    column public =>
        label is _('Public access'),
        type is 'bool';
};

# Your model-specific methods go here.
sub current_user_can {
    my $self = shift;
    my $type = shift;
    my %args = (@_);

    return 1 if $self->current_user->id;

    return 0 if (
        $type eq 'update' ||
        $type eq 'create' ||
        $type eq 'delete'
        );

    return 1;
}

1;

