package a.c.b;

import com.google.protobuf.InvalidProtocolBufferException;
import com.ucar.databus.proto.UCarProto;
import java.util.HashMap;

public class p extends v {

    public class a extends HashMap<Integer, String> {
        public a() {
            put(1, "auth_request");
            put(2, "auth_response");
            put(3, "auth_confirm");
        }
    }

    public static s a(UCarProto.AuthConfirm authConfirm) {
        return c().a(i.SEND).a(3).a(authConfirm);
    }

    public static s a(UCarProto.AuthRequest authRequest) {
        return c().a(i.REQ).a(1).a(authRequest);
    }

    public static s a(UCarProto.AuthResponse authResponse, int i) {
        return c().a(i.RES).a(2).a(authResponse).d(i);
    }

    private static void a(int i, s sVar, i iVar) {
        v.a(f.PB3, c.AUTH, i, sVar, iVar);
    }

    public static void b() {
        v.a(c.AUTH, new a());
    }

    public static boolean b(s sVar) {
        return sVar != null && sVar.f() == c.AUTH && sVar.o() && sVar.j() == 3;
    }

    private static t c() {
        return s.r().a(k.c()).a(c.AUTH);
    }

    public static boolean c(s sVar) {
        return sVar != null && sVar.f() == c.AUTH && sVar.o() && sVar.j() == 1;
    }

    public static boolean d(s sVar) {
        return sVar != null && sVar.f() == c.AUTH && sVar.o() && sVar.j() == 2;
    }

    public static UCarProto.AuthConfirm e(s sVar) {
        a(3, sVar, i.SEND);
        try {
            return UCarProto.AuthConfirm.parseFrom(sVar.b());
        } catch (InvalidProtocolBufferException e) {
            throw new l("parseAuthConfirmMessage error: " + e.getMessage());
        }
    }

    public static UCarProto.AuthRequest f(s sVar) {
        a(1, sVar, i.REQ);
        try {
            return UCarProto.AuthRequest.parseFrom(sVar.b());
        } catch (InvalidProtocolBufferException e) {
            throw new l("parseAuthRequestMessage error: " + e.getMessage());
        }
    }

    public static UCarProto.AuthResponse g(s sVar) {
        a(2, sVar, i.RES);
        try {
            return UCarProto.AuthResponse.parseFrom(sVar.b());
        } catch (InvalidProtocolBufferException e) {
            throw new l("parseAuthResponseMessage error: " + e.getMessage());
        }
    }
}
