//
//  NotificationTitles.swift
//  Feels (iOS)
//
//  Created by Trey Tartt on 2/19/22.
//

import Foundation

protocol PersonalityPackable {
    static var notificationTitles: [String] { get }
    static var notificationBodyToday: [String] { get }
    static var notificationBodyYesterday: [String] { get }
    
    static var title: String { get }
}

enum PersonalityPack: Int, CaseIterable {
    case Default
    case Rude
    
    func randomPushNotificationStrings() -> (title: String, body: String) {
        let onboarding = UserDefaultsStore.getOnboarding()
        
        switch (self, onboarding.inputDay) {
        case (.Default, .Today):
            return (DefaultTitles.notificationTitles.randomElement()!,
                    DefaultTitles.notificationBodyToday.randomElement()!)
        case (.Default, .Previous):
            return (DefaultTitles.notificationTitles.randomElement()!,
                    DefaultTitles.notificationBodyYesterday.randomElement()!)
        case (.Rude, .Today):
            return (RudeTitles.notificationTitles.randomElement()!,
                    RudeTitles.notificationBodyToday.randomElement()!)
        case (.Rude, .Previous):
            return (RudeTitles.notificationTitles.randomElement()!,
                    RudeTitles.notificationBodyYesterday.randomElement()!)
        }
    }
    
    func title() -> String {
        switch self {
        case .Default:
            return DefaultTitles.title
        case .Rude:
            return RudeTitles.title
        }
    }
}

final class DefaultTitles: PersonalityPackable {
    static var title = "Nice"
    
    static var notificationTitles: [String] {
        [
            "Hi 👋",
            "If you have a minute",
            "It's that time agian 😃"
        ]
    }
    
    static var notificationBodyToday: [String] {
        [
            "How was your day",
            "Don't forget to rate your day",
            "Please rate your day",
            "Please tell me how your day was"
        ]
    }
    
    static var notificationBodyYesterday: [String] {
        [
            "How was yesterday",
            "Don't forget to rate yesterday",
            "Please rate yesterday",
            "Please tell me how yesterday was"
        ]
    }
}

final class RudeTitles: PersonalityPackable {
    static var title = "Rude"
    
    static var notificationTitles: [String] {
        [
            "Hey asshat",
            "Hey lazy dickbag",
            "Damn you 😡",
            "Uggghhhhhhh, I gotta deal you with again 😒"
        ]
    }
    
    static var notificationBodyToday: [String] {
        [
            "How the hell was your day",
            "Don't be an ass, rate your day",
            "Rate your damn day .... or else ☠️"
        ]
    }
    
    static var notificationBodyYesterday: [String] {
        [
            "How the hell was yesterday",
            "Don't be an ass, rate yesterday",
            "Rate yesterday ... or else ☠️"
        ]
    }
}
