import {Field, FieldType, Injectable, Model} from '@extollo/lib'

/**
 * Snippet Model
 * -----------------------------------
 * A code snippet or gist for display on the website.
 */
@Injectable()
export class Snippet extends Model<Snippet> {
    protected static table = 'snippets'
    protected static key = 'snippet_id'

    @Field(FieldType.serial, 'snippet_id')
    public snippetId?: number

    @Field(FieldType.varchar)
    public slug!: string

    @Field(FieldType.bool, 'users_only')
    public usersOnly = false

    @Field(FieldType.bool, 'single_access_only')
    public singleAccessOnly = false

    @Field(FieldType.varchar, 'access_key')
    public accessKey?: string

    @Field(FieldType.varchar)
    public syntax?: string

    @Field(FieldType.text)
    public body = ''
}
