<commit_before># frozen_string_literal: true

module MijDiscord::Data
  class Embed
    attr_reader :title

    attr_reader :description

    attr_reader :url

    attr_reader :timestamp

    attr_reader :color

    attr_reader :footer

    attr_reader :thumbnail

    attr_reader :image

    attr_reader :video

    attr_reader :provider

    attr_reader :author

    attr_reader :fields

    def initialize(data)
      @title, @description, @url = data['title'], data['description'], data['url']
      @color = ColorRGB.new(data['color']) if data['color']
      @timestamp = Time.parse(data['timestamp']).utc if data['timestamp']

      @footer = EmbedFooter.new(data['footer']) if data['footer']
      @thumbnail = EmbedMedia.new(data['thumbnail']) if data['thumbnail']

      @image = EmbedMedia.new(data['image']) if data['image']
      @video = EmbedMedia.new(data['video']) if data['video']

      @author = EmbedAuthor.new(data['author']) if data['author']
      @provider = EmbedProvider.new(data['provider']) if data['provider']

      @fields = data['fields']&.map {|x| EmbedField.new(x) }
    end
  end

  class EmbedFooter
    attr_reader :text

    attr_reader :icon_url

    attr_reader :proxy_icon_url

    def initialize(data)
      @text, @icon_url = data['text'], data['icon_url']
      @proxy_icon_url =  data['proxy_icon_url']
    end
  end

  class EmbedMedia
    attr_reader :url

    attr_reader :proxy_url

    attr_reader :width

    attr_reader :height

    def initialize(data)
      @url, @width, @height = data['url'], data['width'], data['height']
      @proxy_url = data['proxy_url']
    end
  end

  class EmbedAuthor
    attr_reader :name

    attr_reader :url

    attr_reader :icon_url

    attr_reader :proxy_icon_url

    def initialize(data)
      @name, @url, @icon_url = data['name'], data['url'], data['icon_url']
      @proxy_icon_url = data['proxy_icon_url']
    end
  end

  class EmbedProvider
    attr_reader :name

    attr_reader :url

    def initialize(data)
      @name, @url = data['name'], data['url']
    end
  end

  class EmbedField
    attr_reader :name

    attr_reader :value

    attr_reader :inline

    def initialize(data)
      @name, @value, @inline = data['name'], data['value'], data['inline']
    end
  end
end<commit_msg>Added type field to Embed struct<commit_after># frozen_string_literal: true

module MijDiscord::Data
  class Embed
    attr_reader :type

    attr_reader :title

    attr_reader :description

    attr_reader :url

    attr_reader :timestamp

    attr_reader :color

    attr_reader :footer

    attr_reader :thumbnail

    attr_reader :image

    attr_reader :video

    attr_reader :provider

    attr_reader :author

    attr_reader :fields

    def initialize(data)
      @type, @url = data['type'], data['url']
      @title, @description = data['title'], data['description']

      @color = ColorRGB.new(data['color']) if data['color']
      @timestamp = Time.parse(data['timestamp']).utc if data['timestamp']

      @footer = EmbedFooter.new(data['footer']) if data['footer']
      @thumbnail = EmbedMedia.new(data['thumbnail']) if data['thumbnail']

      @image = EmbedMedia.new(data['image']) if data['image']
      @video = EmbedMedia.new(data['video']) if data['video']

      @author = EmbedAuthor.new(data['author']) if data['author']
      @provider = EmbedProvider.new(data['provider']) if data['provider']

      @fields = data['fields']&.map {|x| EmbedField.new(x) }
    end
  end

  class EmbedFooter
    attr_reader :text

    attr_reader :icon_url

    attr_reader :proxy_icon_url

    def initialize(data)
      @text, @icon_url = data['text'], data['icon_url']
      @proxy_icon_url =  data['proxy_icon_url']
    end
  end

  class EmbedMedia
    attr_reader :url

    attr_reader :proxy_url

    attr_reader :width

    attr_reader :height

    def initialize(data)
      @url, @width, @height = data['url'], data['width'], data['height']
      @proxy_url = data['proxy_url']
    end
  end

  class EmbedAuthor
    attr_reader :name

    attr_reader :url

    attr_reader :icon_url

    attr_reader :proxy_icon_url

    def initialize(data)
      @name, @url, @icon_url = data['name'], data['url'], data['icon_url']
      @proxy_icon_url = data['proxy_icon_url']
    end
  end

  class EmbedProvider
    attr_reader :name

    attr_reader :url

    def initialize(data)
      @name, @url = data['name'], data['url']
    end
  end

  class EmbedField
    attr_reader :name

    attr_reader :value

    attr_reader :inline

    def initialize(data)
      @name, @value, @inline = data['name'], data['value'], data['inline']
    end
  end
end
{'fraction_non_alphanumeric': 0.1266122098022356, 'fraction_numerical': 0.0, 'mean_word_length': 3.280588776448942, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6405723', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1464, 'n_words': 352}