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

/**
 * ContactSubmission Model
 * -----------------------------------
 * A message submitted via the contact form on my website.
 */
@Injectable()
export class ContactSubmission extends Model<ContactSubmission> {
    protected static table = 'contact_submissions'
    protected static key = 'contact_submission_id'

    @Field(FieldType.serial, 'contact_submission_id')
    protected id?: number

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

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

    @Field(FieldType.text)
    public message!: string

    @Field(FieldType.timestamp, 'sent_at')
    public sentAt = new Date()
}
