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

/**
 * Credential Model
 * -----------------------------------
 * A username and {password|api token} for the PVE cluster.
 */
@Injectable()
export class Credential extends Model<Credential> {
    protected static table = 'p5x_credentials'
    protected static key = 'id'

    @Field(FieldType.serial)
    public id?: number

    @Field(FieldType.varchar, 'pve_username')
    public username!: string

    @Field(FieldType.text, 'pve_credential')
    public credential!: string

    @Field(FieldType.bool, 'is_api_token')
    public isApiToken!: boolean
}
