//
//  MRKTransition.swift
//  dokstor
//
//  Created by Marc Flores on 23/05/2019.
//  Copyright © 2019 Heliocor. All rights reserved.
//

import UIKit

open class MRKTransition : NSObject, UIViewControllerAnimatedTransitioning {
    
    let type:UINavigationController.Operation
    
    public required init( _ type:UINavigationController.Operation) {
        self.type = type
        super.init()
    }
    
    public func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
        return 0
    }
    
    public func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
        switch type {
        case .push:
            pushTransition(transitionContext, time: pushTime)
            break
        case .pop:
            popTransition(transitionContext, time: popTime)
            break
        default:
            break
        }
    }
    
    //MARK : - Computed
    
    open var pushTime:TimeInterval{
        return 0.25
    }
    
    open var popTime:TimeInterval{
        return 0.1
    }
    
    //MARK : - Override
    
    func pushTransition( _ context:UIViewControllerContextTransitioning, time:TimeInterval){
        
    }
    
    func popTransition( _ context:UIViewControllerContextTransitioning, time:TimeInterval){
        
    }
    
}
