import Foundation
import Fake4SwiftKit

// this file was generated by fake4swift
// https://github.com/tjarratt/fake4swift

class FakeMySomewhatSpecialProtocol : MySomewhatSpecialProtocol, Equatable {
    init() {
        self.set_myAttributeArgs = []
        self.set_myNameArgs = []
        self.set_optionalPropertyArgs = []
    }

    fileprivate var _myAttribute : Int?
    fileprivate var set_myAttributeArgs : Array<Int>

    fileprivate var _myName : String?
    fileprivate var set_myNameArgs : Array<String>
    fileprivate var _optionalProperty : Int?
    fileprivate var set_optionalPropertyArgs : Array<Int?>

    var myAttribute : Int {
        get {
            return _myAttribute!
        }

        set {
            _myAttribute = newValue
            set_myAttributeArgs.append(newValue)
        }
    }

    var myName : String {
        get {
            return _myName!
        }

        set {
            _myName = newValue
            set_myNameArgs.append(newValue)
        }
    }

    var optionalProperty : Int? {
        get {
            return _optionalProperty
        }

        set {
            _optionalProperty = newValue
            set_optionalPropertyArgs.append(newValue)
        }
    }

    func setMyAttributeCallCount() -> Int {
        return set_myAttributeArgs.count
    }

    func setMyAttributeArgs(forCall index : Int) throws -> Int {
        if index < 0 || index >= set_myAttributeArgs.count {
            throw NSError.init(domain: "swift-generate-fake-domain", code: 1, userInfo: nil)
        }
        return set_myAttributeArgs[index]
    }

    func setMyNameCallCount() -> Int {
        return set_myNameArgs.count
    }

    func setMyNameArgs(forCall index : Int) throws -> String {
        if index < 0 || index >= set_myNameArgs.count {
            throw NSError.init(domain: "swift-generate-fake-domain", code: 1, userInfo: nil)
        }
        return set_myNameArgs[index]
    }

    func setOptionalPropertyCallCount() -> Int {
        return set_optionalPropertyArgs.count
    }

    func setOptionalPropertyArgs(forCall index : Int) throws -> Int? {
        if index < 0 || index >= set_optionalPropertyArgs.count {
            throw NSError.init(domain: "swift-generate-fake-domain", code: 1, userInfo: nil)
        }
        return set_optionalPropertyArgs[index]
    }

    fileprivate(set) var doesNothingCallCount : Int = 0
    func doesNothing() {
        self.doesNothingCallCount += 1
    }

    fileprivate(set) var doesStuffCallCount : Int = 0
    var doesStuffStub : ((String, [String]) -> ([String], Int))?
    fileprivate var doesStuffArgs : Array<(String, [String])> = []
    func doesStuffReturns(stubbedValues: ([String], Int)) {
        self.doesStuffStub = {(stuff: String, otherStuff: [String]) -> ([String], Int) in
            return stubbedValues
        }
    }
    func doesStuffArgs(forCall callIndex: Int) -> (String, [String]) {
        return self.doesStuffArgs[callIndex]
    }
    func doesStuff(thisStuff stuff: String, thatStuff otherStuff: [String]) -> ([String], Int) {
        guard let stub = self.doesStuffStub else {
            fatalError("Fatal Error: You forgot to stub doesStuff. Crashing. 💥")
        }
        self.doesStuffCallCount += 1
        self.doesStuffArgs.append((stuff, otherStuff))
        return stub(stuff, otherStuff)
    }

    fileprivate(set) var soulOfAFunkyCallCount : Int = 0
    var soulOfAFunkyStub : ((String?) throws -> (String?))?
    fileprivate var soulOfAFunkyArgs : Array<(String?)> = []
    func soulOfAFunkyReturns(stubbedValues: (String?)) {
        self.soulOfAFunkyStub = {(drummer: String?) -> (String?) in
            return stubbedValues
        }
    }
    func soulOfAFunkyArgs(forCall callIndex: Int) -> (String?) {
        return self.soulOfAFunkyArgs[callIndex]
    }
    func soulOfAFunky(drummer: String?) throws -> (String?) {
        guard let stub = self.soulOfAFunkyStub else {
            fatalError("Fatal Error: You forgot to stub soulOfAFunky. Crashing. 💥")
        }
        self.soulOfAFunkyCallCount += 1
        self.soulOfAFunkyArgs.append((drummer))
        return try stub(drummer)
    }

    fileprivate(set) static var staticMethodCallCount : Int = 0
    static var staticMethodStub : ((String, Bool) -> (Array<String>))?
    static fileprivate var staticMethodArgs : Array<(String, Bool)> = []
    static func staticMethodReturns(stubbedValues: (Array<String>)) {
        self.staticMethodStub = {(isStatic: String, soStatic: Bool) -> (Array<String>) in
            return stubbedValues
        }
    }
    static func staticMethodArgs(forCall callIndex: Int) -> (String, Bool) {
        return self.staticMethodArgs[callIndex]
    }
    static func staticMethod(isStatic: String, soStatic: Bool) -> (Array<String>) {
        guard let stub = self.staticMethodStub else {
            fatalError("Fatal Error: You forgot to stub staticMethod. Crashing. 💥")
        }
        self.staticMethodCallCount += 1
        self.staticMethodArgs.append((isStatic, soStatic))
        return stub(isStatic, soStatic)
    }

    static func reset() {
        self.staticMethodArgs = []
        self.staticMethodStub = nil
    }
}

func == (a: FakeMySomewhatSpecialProtocol, b: FakeMySomewhatSpecialProtocol) -> Bool {
    return a === b
}

