<commit_before>//
//  File.swift
//  
//
//  Created by <NAME> on 6/10/21.
//

#if !os(Linux)

import Foundation

// MARK: - ObjC Compatibility

@objc(SEGAnalytics)
public class ObjCAnalytics: NSObject {
    internal let analytics: Analytics
    
    @objc
    public init(configuration: ObjCConfiguration) {
        self.analytics = Analytics(configuration: configuration.configuration)
    }
}

// MARK: - ObjC Events

@objc
extension ObjCAnalytics {
    @objc(track:)
    public func track(name: String) {
        track(name: name, properties: nil)
    }
    

    @objc(track:properties:)
    public func track(name: String, properties: [String: Any]?) {
        analytics.track(name: name, properties: properties)
    }

    /// Associate a user with their unique ID and record traits about them.
    /// - Parameters:
    ///   - userId: A database ID (or email address) for this user. If you don't have a userId
    ///     but want to record traits, you should pass nil. For more information on how we
    ///     generate the UUID and Apple's policies on IDs, see https://segment.io/libraries/ios#ids
    @objc(identify:)
    public func identify(userId: String) {
        identify(userId: userId, traits: nil)
    }

    /// Associate a user with their unique ID and record traits about them.
    /// - Parameters:
    ///   - userId: A database ID (or email address) for this user. If you don't have a userId
    ///     but want to record traits, you should pass nil. For more information on how we
    ///     generate the UUID and Apple's policies on IDs, see https://segment.io/libraries/ios#ids
    ///   - traits: A dictionary of traits you know about the user. Things like: email, name, plan, etc.
    @objc(identify:traits:)
    public func identify(userId: String, traits: [String: Any]?) {
        analytics.identify(userId: userId, traits: traits)
    }
    
    /// Track a screen change with a title, category and other properties.
    /// - Parameters:
    ///   - screenTitle: The title of the screen being tracked.
    @objc(screen:)
    public func screen(title: String) {
        screen(title: title, category: nil, properties: nil)
    }
    
    /// Track a screen change with a title, category and other properties.
    /// - Parameters:
    ///   - screenTitle: The title of the screen being tracked.
    ///   - category: A category to the type of screen if it applies.
    @objc(screen:category:)
    public func screen(title: String, category: String?) {
        analytics.screen(title: title, category: category, properties: nil)
    }
    /// Track a screen change with a title, category and other properties.
    /// - Parameters:
    ///   - screenTitle: The title of the screen being tracked.
    ///   - category: A category to the type of screen if it applies.
    ///   - properties: Any extra metadata associated with the screen. e.g. method of access, size, etc.
    @objc(screen:category:properties:)
    public func screen(title: String, category: String?, properties: [String: Any]?) {
        analytics.screen(title: title, category: category, properties: properties)
    }

    /// Associate a user with a group such as a company, organization, project, etc.
    /// - Parameters:
    ///   - groupId: A unique identifier for the group identification in your system.
    @objc(group:)
    public func group(groupId: String) {
        group(groupId: groupId, traits: nil)
    }

    /// Associate a user with a group such as a company, organization, project, etc.
    /// - Parameters:
    ///   - groupId: A unique identifier for the group identification in your system.
    ///   - traits: Traits of the group you may be interested in such as email, phone or name.
    @objc(group:traits:)
    public func group(groupId: String, traits: [String: Any]?) {
        analytics.group(groupId: groupId, traits: traits)
    }
}

// MARK: - ObjC Peripheral Functionality

@objc
extension ObjCAnalytics {
    @objc
    public var anonymousId: String {
        return analytics.anonymousId
    }
    
    @objc
    public var userId: String? {
        return analytics.userId
    }
    
    @objc
    public func traits() -> [String: Any]? {
        var traits: [String: Any]? = nil
        if let userInfo: UserInfo = analytics.store.currentState() {
            traits = userInfo.traits?.dictionaryValue
        }
        return traits
    }
    
    @objc<commit_msg>Added alias to objective-c bridge (#99)<commit_after>//
//  File.swift
//  
//
//  Created by <NAME> on 6/10/21.
//

#if !os(Linux)

import Foundation

// MARK: - ObjC Compatibility

@objc(SEGAnalytics)
public class ObjCAnalytics: NSObject {
    internal let analytics: Analytics
    
    @objc
    public init(configuration: ObjCConfiguration) {
        self.analytics = Analytics(configuration: configuration.configuration)
    }
}

// MARK: - ObjC Events

@objc
extension ObjCAnalytics {
    @objc(track:)
    public func track(name: String) {
        track(name: name, properties: nil)
    }
    

    @objc(track:properties:)
    public func track(name: String, properties: [String: Any]?) {
        analytics.track(name: name, properties: properties)
    }

    /// Associate a user with their unique ID and record traits about them.
    /// - Parameters:
    ///   - userId: A database ID (or email address) for this user. If you don't have a userId
    ///     but want to record traits, you should pass nil. For more information on how we
    ///     generate the UUID and Apple's policies on IDs, see https://segment.io/libraries/ios#ids
    @objc(identify:)
    public func identify(userId: String) {
        identify(userId: userId, traits: nil)
    }

    /// Associate a user with their unique ID and record traits about them.
    /// - Parameters:
    ///   - userId: A database ID (or email address) for this user. If you don't have a userId
    ///     but want to record traits, you should pass nil. For more information on how we
    ///     generate the UUID and Apple's policies on IDs, see https://segment.io/libraries/ios#ids
    ///   - traits: A dictionary of traits you know about the user. Things like: email, name, plan, etc.
    @objc(identify:traits:)
    public func identify(userId: String, traits: [String: Any]?) {
        analytics.identify(userId: userId, traits: traits)
    }
    
    /// Track a screen change with a title, category and other properties.
    /// - Parameters:
    ///   - screenTitle: The title of the screen being tracked.
    @objc(screen:)
    public func screen(title: String) {
        screen(title: title, category: nil, properties: nil)
    }
    
    /// Track a screen change with a title, category and other properties.
    /// - Parameters:
    ///   - screenTitle: The title of the screen being tracked.
    ///   - category: A category to the type of screen if it applies.
    @objc(screen:category:)
    public func screen(title: String, category: String?) {
        analytics.screen(title: title, category: category, properties: nil)
    }
    /// Track a screen change with a title, category and other properties.
    /// - Parameters:
    ///   - screenTitle: The title of the screen being tracked.
    ///   - category: A category to the type of screen if it applies.
    ///   - properties: Any extra metadata associated with the screen. e.g. method of access, size, etc.
    @objc(screen:category:properties:)
    public func screen(title: String, category: String?, properties: [String: Any]?) {
        analytics.screen(title: title, category: category, properties: properties)
    }

    /// Associate a user with a group such as a company, organization, project, etc.
    /// - Parameters:
    ///   - groupId: A unique identifier for the group identification in your system.
    @objc(group:)
    public func group(groupId: String) {
        group(groupId: groupId, traits: nil)
    }

    /// Associate a user with a group such as a company, organization, project, etc.
    /// - Parameters:
    ///   - groupId: A unique identifier for the group identification in your system.
    ///   - traits: Traits of the group you may be interested in such as email, phone or name.
    @objc(group:traits:)
    public func group(groupId: String, traits: [String: Any]?) {
        analytics.group(groupId: groupId, traits: traits)
    }
    
    @objc(alias:)
    /// The alias method is used to merge two user identities, effectively connecting two sets of user data
    /// as one. This is an advanced method, but it is required to manage user identities successfully in some of our destinations.
    /// - Parameter newId: The new id replacing the old user id.
    public func alias(newId: String) {
        analytics.alias(newId: newId)
    }
}

// MARK: - ObjC Peripheral Functionality

@objc
extension ObjCAnalytics {
    @objc
    public var anonymousId: String {
        return analytics.anonymousId
    }
    
    @objc
    public var userId: String? {
        return analytics.userId
    }
    
    @objc
    public func traits() -> [String: Any]? {
        var traits: [String: Any]? = nil
        if let userInfo: UserInfo = analytics.store.currentState() {
            traits = userInfo.traits?.dictionaryValue
        }
        return traits
    }
    
    @objc
{'fraction_non_alphanumeric': 0.1050755939524838, 'fraction_numerical': 0.0012958963282937365, 'mean_word_length': 2.5013232514177695, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 4, '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': '4215430', 'n_tokens_mistral': 2646, 'n_tokens_neox': 2583, 'n_words': 993}