<commit_before>
import Foundation

extension NotificationsCenterCellViewModel {

    //MARK: Public
    
    func primaryURL(for configuration: Configuration) -> URL? {

        //First try to explicitly generate urls based on notification type to limit url side effects
        var calculatedURL: URL? = nil

        switch notification.type {
        case .userTalkPageMessage,
             .mentionInTalkPage,
             .failedMention,
             .pageReviewed,
             .pageLinked,
             .editMilestone,
             .successfulMention:
            calculatedURL = fullTitleURL(for: configuration)
        case .mentionInEditSummary,
             .editReverted,
             .thanks:
            calculatedURL = fullTitleDiffURL(for: configuration)
        case .userRightsChange:
            calculatedURL = userGroupRightsURL
        case .connectionWithWikidata:
            calculatedURL = connectionWithWikidataItemURL
        case .emailFromOtherUser:
            calculatedURL = customPrefixAgentNameURL(for: configuration, pageNamespace: .user)
        case .welcome:
            calculatedURL = gettingStartedURL(for: configuration)
        case .translationMilestone:

            //purposefully not allowing default to primaryLinkURL from server below
            //business requirements are that there are no destination links for translations notification.
            return nil

        case .loginFailUnknownDevice,
             .loginFailKnownDevice,
             .loginSuccessUnknownDevice:
            calculatedURL = loginNotificationsHelpURL

        case .unknownSystemAlert,
             .unknownSystemNotice,
             .unknownAlert,
             .unknownNotice,
             .unknown:
            break
        }

        //If unable to calculate url, default to primary url returned from server
        return (calculatedURL ?? notification.primaryLinkURL)
    }
}

//MARK: Private Helpers - LinkData

private extension NotificationsCenterCellViewModel {

    //common data used throughout url generation helpers<commit_msg>Add secondary url computed property to NotificationsCenterCellViewModel<commit_after>
import Foundation

extension NotificationsCenterCellViewModel {

    //MARK: Public
    
    func primaryURL(for configuration: Configuration) -> URL? {

        //First try to explicitly generate urls based on notification type to limit url side effects
        var calculatedURL: URL? = nil

        switch notification.type {
        case .userTalkPageMessage,
             .mentionInTalkPage,
             .failedMention,
             .pageReviewed,
             .pageLinked,
             .editMilestone,
             .successfulMention:
            calculatedURL = fullTitleURL(for: configuration)
        case .mentionInEditSummary,
             .editReverted,
             .thanks:
            calculatedURL = fullTitleDiffURL(for: configuration)
        case .userRightsChange:
            calculatedURL = userGroupRightsURL
        case .connectionWithWikidata:
            calculatedURL = connectionWithWikidataItemURL
        case .emailFromOtherUser:
            calculatedURL = customPrefixAgentNameURL(for: configuration, pageNamespace: .user)
        case .welcome:
            calculatedURL = gettingStartedURL(for: configuration)
        case .translationMilestone:

            //purposefully not allowing default to primaryLinkURL from server below
            //business requirements are that there are no destination links for translations notification.
            return nil

        case .loginFailUnknownDevice,
             .loginFailKnownDevice,
             .loginSuccessUnknownDevice:
            calculatedURL = loginNotificationsHelpURL

        case .unknownSystemAlert,
             .unknownSystemNotice,
             .unknownAlert,
             .unknownNotice,
             .unknown:
            break
        }

        //If unable to calculate url, default to primary url returned from server
        return (calculatedURL ?? notification.primaryLinkURL)
    }
    
    func secondaryURL(for configuration: Configuration) -> URL? {
        var calculatedURL: URL? = nil

        switch notification.type {
        case .userTalkPageMessage,
             .mentionInTalkPage,
             .mentionInEditSummary,
             .editReverted,
             .userRightsChange,
             .pageReviewed,
             .pageLinked,
             .connectionWithWikidata,
             .thanks,
             .unknownAlert,
             .unknownNotice:
            calculatedURL = customPrefixAgentNameURL(for: configuration, pageNamespace: .user)
        case .failedMention,
             .successfulMention,
             .emailFromOtherUser,
             .translationMilestone,
             .editMilestone,
             .welcome,
             .loginFailUnknownDevice,
             .loginFailKnownDevice,
             .loginSuccessUnknownDevice,
             .unknownSystemAlert,
             .unknownSystemNotice,
             .unknown:
            break
        }

        return calculatedURL
    }
}

//MARK: Private Helpers - LinkData

private extension NotificationsCenterCellViewModel {

    //common data used throughout url generation helpers
{'fraction_non_alphanumeric': 0.05557677616501146, 'fraction_numerical': 0.0, 'mean_word_length': 1.9554176072234764, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '1217852', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1182, 'n_words': 325}