module.exports = (sequelize, type) => {

    const Video = sequelize.define('videos', {
        id: {
            type: type.INTEGER,
            primaryKey: true,
            autoIncrement: true
        },
        certi_id: type.INTEGER,
        video_link: type.TEXT,
        video_title: type.TEXT,
        video_thumbnil: type.TEXT,
        c_id: type.INTEGER,
        d_id: type.INTEGER,
        sd_id: type.TEXT,
        // topic_id: type.INTEGER,
        topic_id: { type: type.TEXT, allowNull: true, get: function () { return this.getDataValue('topic_id') ? this.getDataValue('topic_id').split(',') : [] } },
        subtopic_ids: { type: type.TEXT, allowNull: true, get: function () { return this.getDataValue('subtopic_ids') ? this.getDataValue('subtopic_ids').split(',') : [] } },
        type: type.ENUM('FREE', 'PAID'),
        video_type: type.ENUM('REQUIRED', 'OPTIONAL'),
        transcript_link: type.TEXT,
        viewed_users: { type: type.TEXT, allowNull: true, get: function () { return this.getDataValue('viewed_users') ? this.getDataValue('viewed_users').split(',') : [] } },
        point: type.INTEGER,
        duration: type.TEXT,
        chapters: type.TEXT,
        qr_code: type.TEXT,
        video_lesson_link: type.TEXT,
        video_lesson_link_720p: type.TEXT,
        video_lesson_link_480p: type.TEXT,
        video_lesson_link_360p: type.TEXT,
        video_lesson_link_240p: type.TEXT,
        video_lesson_link_144p: type.TEXT,
        topic_list: type.TEXT,
        summary: type.TEXT,
        sr_number: {
            type: type.INTEGER,
            defaultValue: 0
        },
        status: {
            type: type.INTEGER,
            defaultValue: 0
        },
        bkp_sd_id: { type: type.TEXT, allowNull: true, get: function () { return this.getDataValue('bkp_sd_id') ? this.getDataValue('bkp_sd_id').split(',') : [] } },
        is_mini_masterclass_video: {
            type: type.INTEGER,
            defaultValue: 0
        }
    })
    return Video;
}