// Path: app/src/main/java/es/rogermartinez/paddlemanager/base/domain/DomainErrorHandler.java
// public class DomainErrorHandler {
// 
//     private Bus bus;
// 
//     public DomainErrorHandler(Bus bus) {
//         this.bus = bus;
//     }
// 
//     public void notifyError(ErrorEvent errorObject) throws Throwable {
//         bus.post(errorObject);
//     }
// 
// 
// 
// 
// }
// 
// Path: app/src/main/java/es/rogermartinez/paddlemanager/base/domain/interactor/MainThread.java
// public interface MainThread {
//     void post(Runnable runnable);
// }
// 
// Path: app/src/main/java/es/rogermartinez/paddlemanager/base/domain/interactor/impl/UserCaseJob.java
// public abstract class UserCaseJob extends Job {
//     protected static final int LOW_PRIORITY = 1;
//     protected static final int DEFAULT_PRIORITY = 2;
//     protected static final int HIGH_PRIORITY = 3;
// 
//     protected static final String GROUP_HIDE_APPLICATION = "hide_application";
// 
//     public static final AtomicInteger COUNTER = new AtomicInteger(0);
// 
//     private final MainThread mainThread;
//     protected JobManager jobManager;
//     protected DomainErrorHandler domainErrorHandler;
// 
// 
//     protected UserCaseJob(JobManager jobManager, MainThread mainThread, Params params, DomainErrorHandler domainErrorHandler) {
//         super(params);
//         this.jobManager = jobManager;
//         this.mainThread = mainThread;
//         this.domainErrorHandler = domainErrorHandler;
//     }
// 
//     protected void sendCallback(Runnable callback) {
//         mainThread.post(callback);
//     }
// 
//     @Override
//     public void onAdded() {
//         COUNTER.incrementAndGet();
//     }
// 
//     @Override
//     public void onRun() throws Throwable {
//         try {
//             //calls abstract method implemented in child UserJob.
//             doRun();
//             COUNTER.decrementAndGet();
//         } catch (Exception e) {
//             //CrashlyticsWrapper.logException(e);
// 
//             // TODO manage errors
//             domainErrorHandler.notifyError(new GeneralErrorEvent(e));
//         }
//     }
// 
//     public abstract void doRun() throws Throwable;
// 
//     @Override
//     protected void onCancel() {
//         COUNTER.decrementAndGet();
//     }
// 
//     @Override
//     protected boolean shouldReRunOnThrowable(Throwable throwable) {
//         return false;
//     }
// }
// 
// Path: app/src/main/java/es/rogermartinez/paddlemanager/base/domain/model/Player.java
// public class Player implements Serializable {
//     private long id;
//     private String name = "";
//     private int level = 0;
//     private int sex = 0;
//     private int position = 0;
//     private String comment = "";
// 
//     public long getId() {
//         return id;
//     }
// 
//     public void setId(long id) {
//         this.id = id;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public int getLevel() {
//         return level;
//     }
// 
//     public void setLevel(int level) {
//         this.level = level;
//     }
// 
//     public int getSex() {
//         return sex;
//     }
// 
//     public void setSex(int sex) {
//         this.sex = sex;
//     }
// 
//     public int getPosition() {
//         return position;
//     }
// 
//     public void setPosition(int position) {
//         this.position = position;
//     }
// 
//     public String getComment() {
//         return comment;
//     }
// 
//     public void setComment(String comment) {
//         this.comment = comment;
//     }
// }
// 
// Path: app/src/main/java/es/rogermartinez/paddlemanager/editplayer/datasource/CreatePlayerDataSource.java
// public interface CreatePlayerDataSource {
//     void createPlayer(Player player);
// }
// 
// Path: app/src/main/java/es/rogermartinez/paddlemanager/editplayer/domain/callback/CreatePlayerCallback.java
// public interface CreatePlayerCallback {
//     void onCreatePlayerSuccess();
// }
// 
// Path: app/src/main/java/es/rogermartinez/paddlemanager/editplayer/domain/usercase/CreatePlayer.java
// public interface CreatePlayer {
//     void createPlayer(Player player, CreatePlayerCallback callback);
// }


import com.path.android.jobqueue.JobManager;
import com.path.android.jobqueue.Params;
import javax.inject.Inject;
import es.rogermartinez.paddlemanager.base.domain.DomainErrorHandler;
import es.rogermartinez.paddlemanager.base.domain.interactor.MainThread;
import es.rogermartinez.paddlemanager.base.domain.interactor.impl.UserCaseJob;
import es.rogermartinez.paddlemanager.base.domain.model.Player;
import es.rogermartinez.paddlemanager.editplayer.datasource.CreatePlayerDataSource;
import es.rogermartinez.paddlemanager.editplayer.domain.callback.CreatePlayerCallback;
import es.rogermartinez.paddlemanager.editplayer.domain.usercase.CreatePlayer;
package es.rogermartinez.paddlemanager.editplayer.domain.usercase.impl;




/**
 * Created by roger.martinez on 17/11/15.
 */
public class CreatePlayerJob extends UserCaseJob implements CreatePlayer {

    private Player player;
    private CreatePlayerCallback callback;
    private CreatePlayerDataSource createPlayerDataSource;

    @Inject
    public CreatePlayerJob(JobManager jobManager, MainThread mainThread,
                           DomainErrorHandler domainErrorHandler, CreatePlayerDataSource createPlayerDataSource){
        super(jobManager, mainThread, new Params(UserCaseJob.DEFAULT_PRIORITY).setRequiresNetwork(false), domainErrorHandler);
        this.createPlayerDataSource = createPlayerDataSource;
    }


// Path: app/src/main/java/es/rogermartinez/paddlemanager/base/domain/DomainErrorHandler.java
// public class DomainErrorHandler {
// 
//     private Bus bus;
// 
//     public DomainErrorHandler(Bus bus) {
//         this.bus = bus;
//     }
// 
//     public void notifyError(ErrorEvent errorObject) throws Throwable {
//         bus.post(errorObject);
//     }
// 
// 
// 
// 
// }
// 
// Path: app/src/main/java/es/rogermartinez/paddlemanager/base/domain/interactor/MainThread.java
// public interface MainThread {
//     void post(Runnable runnable);
// }
// 
// Path: app/src/main/java/es/rogermartinez/paddlemanager/base/domain/interactor/impl/UserCaseJob.java
// public abstract class UserCaseJob extends Job {
//     protected static final int LOW_PRIORITY = 1;
//     protected static final int DEFAULT_PRIORITY = 2;
//     protected static final int HIGH_PRIORITY = 3;
// 
//     protected static final String GROUP_HIDE_APPLICATION = "hide_application";
// 
//     public static final AtomicInteger COUNTER = new AtomicInteger(0);
// 
//     private final MainThread mainThread;
//     protected JobManager jobManager;
//     protected DomainErrorHandler domainErrorHandler;
// 
// 
//     protected UserCaseJob(JobManager jobManager, MainThread mainThread, Params params, DomainErrorHandler domainErrorHandler) {
//         super(params);
//         this.jobManager = jobManager;
//         this.mainThread = mainThread;
//         this.domainErrorHandler = domainErrorHandler;
//     }
// 
//     protected void sendCallback(Runnable callback) {
//         mainThread.post(callback);
//     }
// 
//     @Override
//     public void onAdded() {
//         COUNTER.incrementAndGet();
//     }
// 
//     @Override
//     public void onRun() throws Throwable {
//         try {
//             //calls abstract method implemented in child UserJob.
//             doRun();
//             COUNTER.decrementAndGet();
//         } catch (Exception e) {
//             //CrashlyticsWrapper.logException(e);
// 
//             // TODO manage errors
//             domainErrorHandler.notifyError(new GeneralErrorEvent(e));
//         }
//     }
// 
//     public abstract void doRun() throws Throwable;
// 
//     @Override
//     protected void onCancel() {
//         COUNTER.decrementAndGet();
//     }
// 
//     @Override
//     protected boolean shouldReRunOnThrowable(Throwable throwable) {
//         return false;
//     }
// }
// 
// Path: app/src/main/java/es/rogermartinez/paddlemanager/base/domain/model/Player.java
// public class Player implements Serializable {
//     private long id;
//     private String name = "";
//     private int level = 0;
//     private int sex = 0;
//     private int position = 0;
//     private String comment = "";
// 
//     public long getId() {
//         return id;
//     }
// 
//     public void setId(long id) {
//         this.id = id;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public int getLevel() {
//         return level;
//     }
// 
//     public void setLevel(int level) {
//         this.level = level;
//     }
// 
//     public int getSex() {
//         return sex;
//     }
// 
//     public void setSex(int sex) {
//         this.sex = sex;
//     }
// 
//     public int getPosition() {
//         return position;
//     }
// 
//     public void setPosition(int position) {
//         this.position = position;
//     }
// 
//     public String getComment() {
//         return comment;
//     }
// 
//     public void setComment(String comment) {
//         this.comment = comment;
//     }
// }
// 
// Path: app/src/main/java/es/rogermartinez/paddlemanager/editplayer/datasource/CreatePlayerDataSource.java
// public interface CreatePlayerDataSource {
//     void createPlayer(Player player);
// }
// 
// Path: app/src/main/java/es/rogermartinez/paddlemanager/editplayer/domain/callback/CreatePlayerCallback.java
// public interface CreatePlayerCallback {
//     void onCreatePlayerSuccess();
// }
// 
// Path: app/src/main/java/es/rogermartinez/paddlemanager/editplayer/domain/usercase/CreatePlayer.java
// public interface CreatePlayer {
//     void createPlayer(Player player, CreatePlayerCallback callback);
// }


// Path: app/src/main/java/es/rogermartinez/paddlemanager/editplayer/domain/usercase/impl/CreatePlayerJob.java
import com.path.android.jobqueue.JobManager;
import com.path.android.jobqueue.Params;
import javax.inject.Inject;
import es.rogermartinez.paddlemanager.base.domain.DomainErrorHandler;
import es.rogermartinez.paddlemanager.base.domain.interactor.MainThread;
import es.rogermartinez.paddlemanager.base.domain.interactor.impl.UserCaseJob;
import es.rogermartinez.paddlemanager.base.domain.model.Player;
import es.rogermartinez.paddlemanager.editplayer.datasource.CreatePlayerDataSource;
import es.rogermartinez.paddlemanager.editplayer.domain.callback.CreatePlayerCallback;
import es.rogermartinez.paddlemanager.editplayer.domain.usercase.CreatePlayer;

package es.rogermartinez.paddlemanager.editplayer.domain.usercase.impl;




/**
 * Created by roger.martinez on 17/11/15.
 */
public class CreatePlayerJob extends UserCaseJob implements CreatePlayer {

    private Player player;
    private CreatePlayerCallback callback;
    private CreatePlayerDataSource createPlayerDataSource;

    @Inject
    public CreatePlayerJob(JobManager jobManager, MainThread mainThread,
                           DomainErrorHandler domainErrorHandler, CreatePlayerDataSource createPlayerDataSource){
        super(jobManager, mainThread, new Params(UserCaseJob.DEFAULT_PRIORITY).setRequiresNetwork(false), domainErrorHandler);
        this.createPlayerDataSource = createPlayerDataSource;
    }


    @Override