<commit_before>﻿using MovieDatabase.DatabaseClassinstance;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MovieDatabase.ExportDataToFiles.ExportingDataToFilesClasses
{
    public class JSONGenerator
    {
        public void JsonGenerate()
        {
            var database = new Database();
            var db = database.GetInstance();
            var movies = db.Movies
                             .OrderBy(m => m.Name)
                             .Select(m => new
                             {
                                 id = m.Id,
                                 name = m.Name,
                                 rating = m.Rating,
                                 year = m.Year,
                                 description = m.Description,
                                 duration = m.Duration,
                                 genres = m.Genres
                                           .Select(g => g.Name)
                                           .ToList(),
                                 directors = m.Employees
                                              .Where(e => e.IsDirector == true)
                                              .Select(ed => new<commit_msg>Modified class JSONGenerator.cs.<commit_after>﻿using MovieDatabase.DatabaseClassinstance;
using MovieDatabase.ExportDataToFiles.Interfaces;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MovieDatabase.ExportDataToFiles.ExportingDataToFilesClasses
{
    public class JSONGenerator : IGenerator
    {
        public void Generate(Database dbContext)
        {
            var db = dbContext.GetInstance();
            var movies = db.Movies
                             .OrderBy(m => m.Name)
                             .Select(m => new
                             {
                                 id = m.Id,
                                 name = m.Name,
                                 rating = m.Rating,
                                 year = m.Year,
                                 description = m.Description,
                                 duration = m.Duration,
                                 genres = m.Genres
                                           .Select(g => g.Name)
                                           .ToList(),
                                 directors = m.Employees
                                              .Where(e => e.IsDirector == true)
                                              .Select(ed => new
{'fraction_non_alphanumeric': 0.07094846900672143, 'fraction_numerical': 0.0, 'mean_word_length': 0.9149392423159399, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3527940', 'n_tokens_mistral': 548, 'n_tokens_neox': 545, 'n_words': 125}