// announcement.js
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0

'use strict';

const path = require('path');

const mongoose = require('mongoose');

const Schema = mongoose.Schema;

const {
  ResourceStats,
  ResourceStatsDefaults,
} = require(path.join(__dirname, 'lib', 'resource-stats.js'));


const AnnouncementSchema = new Schema({
  created: { type: Date, default: Date.now, required: true, index: -1 },
  title: {
    icon: {
      class: { type: String, default: 'fa-bullhorn', required: true },
      color: { type: String, default: '#ffffff', required: true },
    },
    content: { type: String, required: true },
  },
  content: { type: String, required: true },
  resourceStats: { type: ResourceStats, default: ResourceStatsDefaults, required: true },
});

module.exports = mongoose.model('Announcement', AnnouncementSchema);