<commit_before>﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities;

public record FilterList
{
    public int Id { get; init; }
    public string Name { get; init; } = null!;
    public string? Description { get; init; }
    public int? LicenseId { get; init; }
    public License? License { get; }
    public IReadOnlyCollection<FilterListSyntax> FilterListSyntaxes { get; } = new HashSet<FilterListSyntax>();
    public IReadOnlyCollection<FilterListLanguage> FilterListLanguages { get; } = new HashSet<FilterListLanguage>();
    public IReadOnlyCollection<FilterListTag> FilterListTags { get; } = new HashSet<FilterListTag>();
    public IReadOnlyCollection<FilterListViewUrl> ViewUrls { get; } = new HashSet<FilterListViewUrl>();
    public Uri? HomeUrl { get; init; }
    public Uri? OnionUrl { get; init; }
    public Uri? PolicyUrl { get; init; }
    public Uri? SubmissionUrl { get; init; }
    public Uri? IssuesUrl { get; init; }
    public Uri? ForumUrl { get; init; }
    public Uri? ChatUrl { get; init; }
    public string? EmailAddress { get; init; }
    public Uri? DonateUrl { get; init; }
    public IReadOnlyCollection<FilterListMaintainer> FilterListMaintainers { get; } = new HashSet<FilterListMaintainer>();
    public IReadOnlyCollection<Fork> UpstreamFilterLists { get; } = new HashSet<Fork>();
    public IReadOnlyCollection<Fork> ForkFilterLists { get; } = new HashSet<Fork>();
    public IReadOnlyCollection<Merge> IncludedInFilterLists { get; } = new HashSet<Merge>();
    public IReadOnlyCollection<Merge> IncludesFilterLists { get; } = new HashSet<Merge>();
    public IReadOnlyCollection<Dependent> DependencyFilterLists { get; } = new HashSet<Dependent>();
    public IReadOnlyCollection<Dependent> DependentFilterLists { get; } = new HashSet<Dependent>();
}

internal class FilterListTypeConfiguration : IEntityTypeConfiguration<FilterList>
{
    public virtual void Configure(EntityTypeBuilder<FilterList> builder)
    {
        builder.HasIndex(f => f.Name)
            .IsUnique();
        builder.HasDataJsonFile<FilterList>();
    }
}
<commit_msg>refactor(dir): ♻ require a license and default to All Rights Reserved<commit_after>﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities;

public record FilterList
{
    public int Id { get; init; }
    public string Name { get; init; } = null!;
    public string? Description { get; init; }
    public int LicenseId { get; init; }
    public License License { get; } = null!;
    public IReadOnlyCollection<FilterListSyntax> FilterListSyntaxes { get; } = new HashSet<FilterListSyntax>();
    public IReadOnlyCollection<FilterListLanguage> FilterListLanguages { get; } = new HashSet<FilterListLanguage>();
    public IReadOnlyCollection<FilterListTag> FilterListTags { get; } = new HashSet<FilterListTag>();
    public IReadOnlyCollection<FilterListViewUrl> ViewUrls { get; } = new HashSet<FilterListViewUrl>();
    public Uri? HomeUrl { get; init; }
    public Uri? OnionUrl { get; init; }
    public Uri? PolicyUrl { get; init; }
    public Uri? SubmissionUrl { get; init; }
    public Uri? IssuesUrl { get; init; }
    public Uri? ForumUrl { get; init; }
    public Uri? ChatUrl { get; init; }
    public string? EmailAddress { get; init; }
    public Uri? DonateUrl { get; init; }
    public IReadOnlyCollection<FilterListMaintainer> FilterListMaintainers { get; } = new HashSet<FilterListMaintainer>();
    public IReadOnlyCollection<Fork> UpstreamFilterLists { get; } = new HashSet<Fork>();
    public IReadOnlyCollection<Fork> ForkFilterLists { get; } = new HashSet<Fork>();
    public IReadOnlyCollection<Merge> IncludedInFilterLists { get; } = new HashSet<Merge>();
    public IReadOnlyCollection<Merge> IncludesFilterLists { get; } = new HashSet<Merge>();
    public IReadOnlyCollection<Dependent> DependencyFilterLists { get; } = new HashSet<Dependent>();
    public IReadOnlyCollection<Dependent> DependentFilterLists { get; } = new HashSet<Dependent>();
}

internal class FilterListTypeConfiguration : IEntityTypeConfiguration<FilterList>
{
    public virtual void Configure(EntityTypeBuilder<FilterList> builder)
    {
        builder.HasIndex(f => f.Name)
            .IsUnique();
        builder.Property(f => f.LicenseId)
            .HasDefaultValue(5);
        builder.HasDataJsonFile<FilterList>();
    }
}

{'fraction_non_alphanumeric': 0.1071035847811744, 'fraction_numerical': 0.00021992522542335605, 'mean_word_length': 4.628712871287129, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 56, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5665237', 'n_tokens_mistral': 1302, 'n_tokens_neox': 1285, 'n_words': 330}