var thinky = require('thinky')();
var thinkyType = thinky.type;

export var Person = thinky.createModel("person", {
    id: thinkyType.string(),
    email: thinkyType.string()
});

export var Field = thinky.createModel("field", {
    id: thinkyType.string(),
    label: thinkyType.string(),
    type: thinkyType.string().enum(['NUMBER', 'STRING', 'BOOLEAN']), // TODO: Change this to use the same enum from the graphql schema
    choices: []
})

export var Note = thinky.createModel("note", {
    id: thinkyType.string(),
    about: {
        table: thinkyType.string(),
        id: thinkyType.string()
    },
    fieldId: thinkyType.string(),
    value: thinkyType.any(),
    source: {
        table: thinkyType.string(),
        id: thinkyType.string()
    }
})

export var GroupCall = thinky.createModel("group_call", {
    id: thinkyType.string(),
    invitees: [{
        personId: thinkyType.string(),
        signedUp: thinkyType.boolean(),
        attended: thinkyType.boolean()
    }]
})
import thinky from './thinky';
var thinkyType = thinky.type;

export var Person = thinky.createModel("person", {
    id: thinkyType.string(),
    email: thinkyType.string()
});

export var Field = thinky.createModel("field", {
    id: thinkyType.string(),
    label: thinkyType.string(),
    type: thinkyType.string().enum(['NUMBER', 'STRING', 'BOOLEAN']),
    choices: []
})

export var Note = thinky.createModel("note", {
    id: thinkyType.string(),
    about: {
        table: thinkyType.string(),
        id: thinkyType.string()
    },
    fieldId: thinkyType.string(),
    value: thinkyType.any(),
    source: {
        table: thinkyType.string(),
        id: thinkyType.string()
    }
})

// An invitation gets sent to volunteers and they can pick one group call.
export var GroupCallInvitation = thinky.createModel("group_call_invitation", {
    id: thinkyType.string(),
    topic: thinkyType.string(),
    groupCalls: [GroupCall]
})

export var GroupCall = thinky.createModel("group_call", {
    id: thinkyType.string(),
    scheduledTime: thinkyType.date(),
    maxSignups: thinkyType.number(),
    signups: [{
        personId: thinkyType.string(),
        attended: thinkyType.boolean()
    }]
})
Add group call invitation model
Add group call invitation model
