package ch.mod_p.sre24.e5.data;

import android.content.Context;
import ch.mod_p.sre24.e5.R;
import ch.mod_p.sre24.e5.data.Result;
import ch.mod_p.sre24.e5.data.model.LoggedInUser;
import java.io.IOException;
import java.util.UUID;

/* loaded from: classes.dex */
public class LoginDataSource {
    public void logout() {
    }

    public Result<LoggedInUser> login(Context context, String str, String str2) {
        try {
            if (str.compareTo(context.getString(R.string.username)) != 0) {
                return new Result.Error(new Exception("Unknown username"));
            }
            if (new StringBuffer(str2).reverse().toString().compareTo(context.getString(R.string.password)) != 0) {
                return new Result.Error(new Exception("Wrong password"));
            }
            return new Result.Success(new LoggedInUser(UUID.randomUUID().toString(), str));
        } catch (Exception e) {
            return new Result.Error(new IOException("Error logging in", e));
        }
    }
}
