option java_package = "org.microg.gms.auth";

option java_outer_classname = "AuthProto";

message ConsentData {
    message AppDetails {
        optional string title = 1;
        optional string email = 3;
    }
    optional AppDetails app = 1;
    message ScopeDetails {
        optional string title = 1;
        optional string description = 2;
        optional string id = 6;
    }
    repeated ScopeDetails scopes = 2;
}

message RequestOptions {
//    optional bool field_1 = 1;
//    optional string field_2 = 2;
//    optional string field_3 = 3;
//    optional int32 field_4 = 4;
//    optional int32 field_5 = 5;
    optional int32 remote = 7;
    optional NonceWrapper nonceWrapper = 8;
    optional int32 version = 10;
    optional string sessionId = 11;
//    optional bool field_12 = 12;
}

message NonceWrapper {
    optional string nonce = 1;
}

message ConsentUrlResponse {
    optional int32 resultCode = 2;
    optional string consentUrl = 3;
    optional Cookie cookie = 4;
}

message ConsentCookiesResponse {
    optional ConsentCookies consentCookies = 1;
}

message ConsentCookies {
    optional int32 resultCode = 1;
    repeated Cookie cookies = 2;
}

message Cookie {
    optional string cookieName = 1;
    optional string cookieValue = 2;
    optional string domain = 3;
    optional string path = 4;
    optional int64 sameSite = 5;
    optional int64 secure = 6;
    optional int64 httpOnly = 7;
    optional int64 maxAge = 8;
    optional int64 version = 9;
    optional string discard = 10;
    optional string comment = 12;
}

message ItAuthData {
    optional bytes auth = 1;
    repeated bytes tokens = 2;
    optional bytes signature = 3;
}

message ItMetadataData {
    message ScopeEntry {
        repeated string name = 1;
        optional int32 id = 2;
    }
    repeated ScopeEntry entries = 1;
    optional TokenField field = 3;
    optional int32 liveTime = 4;
}

message TokenField {
    enum FieldType {
        UNKNOWN = 0;
        SCOPE = 1;
        EXPIRATION = 2;
    }
    repeated FieldType types = 1 [packed = true];
}

message OAuthAuthorization {
    repeated int32 scopeIds = 1 [packed = true];
    optional int32 effectiveDurationSeconds = 2;
}

message OAuthTokenData {
    optional int32 fieldType = 1;
    optional bytes authorization = 2;
    optional int32 durationMillis = 3;
}