862e0e70afd4979a4faa040dfe9191f174bafa04
[motion.git] / server / models / chat_website.js
1 /**
2  * Chat Website Model
3  */
4
5 var crypto = require('crypto');
6
7 module.exports = function (sequelize, DataTypes) {
8
9         var ChatWebsite = sequelize.define('ChatWebsite', {
10                 name: DataTypes.STRING,
11                 address: {
12                         type: DataTypes.STRING,
13                         unique: true
14                 },
15                 description: DataTypes.STRING,
16                 color: {
17                         type: DataTypes.STRING,
18                         defaultValue: '#000080'
19                 },
20                 color_focus: {
21                         type: DataTypes.STRING,
22                         defaultValue: '#000080'
23                 },
24                 color_button: {
25                         type: DataTypes.STRING,
26                         defaultValue: '#000080'
27                 },
28                 remote: DataTypes.STRING,
29                 animation: {
30                         type: DataTypes.BOOLEAN,
31                         defaultValue: true
32                 },
33                 header_shape: {
34                         type: DataTypes.ENUM('rounded', 'squared'),
35                         defaultValue: 'rounded'
36                 },
37                 header_online: {
38                         type: DataTypes.STRING,
39                         defaultValue: 'We are here!'
40                 },
41                 online_message: {
42                         type: DataTypes.STRING,
43                         defaultValue: '<strong>Questions?<\/strong><br \/>Insert your name and email address to start a live-chat with our support team.'
44                 },
45                 username_placeholder: {
46                         type: DataTypes.STRING,
47                         defaultValue: 'Your name'
48                 },
49                 email_placeholder: {
50                         type: DataTypes.STRING,
51                         defaultValue: 'Your e-mail address'
52                 },
53                 start_chat_button: {
54                         type: DataTypes.STRING,
55                         defaultValue: 'Chat'
56                 },
57                 header_offline: {
58                         type: DataTypes.STRING,
59                         defaultValue: 'Contact us'
60                 },
61                 offline_message: {
62                         type: DataTypes.STRING,
63                         defaultValue: '<strong>We\'re not online.<\/strong><br \/>It doesn\'t mean we\'re not there to help - leave your message below and we\'ll be in touch as soon as possible.'
64                 },
65                 enquiry_message_placeholder: {
66                         type: DataTypes.STRING,
67                         defaultValue: 'Your message...'
68                 },
69                 enquiry_button: {
70                         type: DataTypes.STRING,
71                         defaultValue: 'Leave message'
72                 },
73                 download_transcript: {
74                         type: DataTypes.BOOLEAN,
75                         defaultValue: true
76                 },
77                 enquiry_forwarding: {
78                         type: DataTypes.BOOLEAN,
79                         defaultValue: false
80                 },
81                 enquiry_forwarding_address: {
82                         type: DataTypes.STRING
83                 },
84         }, {
85                 tableName: 'chat_websites',
86                 associate: function (models) {
87                         // hasMany relations
88                         ChatWebsite.belongsTo(models.MailTemplate, {
89                                 as: 'OfflineTemplate'
90                         });
91                         ChatWebsite.hasMany(models.ChatRoom);
92                         ChatWebsite.hasMany(models.ChatApplication);
93                 }
94         });
95
96         return ChatWebsite;
97 };