class News {
  constructor(row) {
    this.id = row.id
    this.title = row.title
    this.summary = row.summary
    this.content = row.content
    this.slug = row.slug
    this.category = row.category
    this.object_storage_id = row.object_storage_id
    this.original_filename = row.original_filename
    this.is_active = !!row.is_active
    this.published_at = row.published_at
    this.created_at = row.created_at
    this.updated_at = row.updated_at
  }

  toJSON() {
    return {
      id: this.id,
      title: this.title,
      summary: this.summary,
      content: this.content,
      slug: this.slug,
      category: this.category,
      object_storage_id: this.object_storage_id,
      original_filename: this.original_filename,
      is_active: this.is_active,
      published_at: this.published_at,
      created_at: this.created_at,
      updated_at: this.updated_at,
    }
  }
}

module.exports = News
