// Extracted from: Spotify 1.1.61.583 (Windows)

syntax = "proto3";

package spotify.connectstate;

option optimize_for = CODE_SIZE;
option java_package = "com.spotify.connectstate.model";

message PlayerState {
    int64 timestamp = 1;
    string context_uri = 2;
    string context_url = 3;
    Restrictions context_restrictions = 4;
    PlayOrigin play_origin = 5;
    ContextIndex index = 6;
    ProvidedTrack track = 7;
    string playback_id = 8;
    double playback_speed = 9;
    int64 position_as_of_timestamp = 10;
    int64 duration = 11;
    bool is_playing = 12;
    bool is_paused = 13;
    bool is_buffering = 14;
    bool is_system_initiated = 15;
    ContextPlayerOptions options = 16;
    Restrictions restrictions = 17;
    Suppressions suppressions = 18;
    repeated ProvidedTrack prev_tracks = 19;
    repeated ProvidedTrack next_tracks = 20;
    map<string, string> context_metadata = 21;
    map<string, string> page_metadata = 22;
    string session_id = 23;
    string queue_revision = 24;
    int64 position = 25;
    string entity_uri = 26;
    repeated ProvidedTrack reverse = 27;
    repeated ProvidedTrack future = 28;
    string audio_stream = 29;
    bool is_optional = 30 [deprecated = true];
    int64 bitrate = 31 [deprecated = true];
    PlaybackQuality playback_quality = 32;
}

message ProvidedTrack {
    string uri = 1;
    string uid = 2;
    map<string, string> metadata = 3;
    repeated string removed = 4;
    repeated string blocked = 5;
    string provider = 6;
    Restrictions restrictions = 7;
    string album_uri = 8;
    repeated string disallow_reasons = 9;
    string artist_uri = 10;
    repeated string disallow_undecided = 11;
}

message ContextIndex {
    uint32 page = 1;
    uint32 track = 2;
}

message Restrictions {
    repeated string disallow_pausing_reasons = 1;
    repeated string disallow_resuming_reasons = 2;
    repeated string disallow_seeking_reasons = 3;
    repeated string disallow_peeking_prev_reasons = 4;
    repeated string disallow_peeking_next_reasons = 5;
    repeated string disallow_skipping_prev_reasons = 6;
    repeated string disallow_skipping_next_reasons = 7;
    repeated string disallow_toggling_repeat_context_reasons = 8;
    repeated string disallow_toggling_repeat_track_reasons = 9;
    repeated string disallow_toggling_shuffle_reasons = 10;
    repeated string disallow_set_queue_reasons = 11;
    repeated string disallow_interrupting_playback_reasons = 12;
    repeated string disallow_transferring_playback_reasons = 13;
    repeated string disallow_remote_control_reasons = 14;
    repeated string disallow_inserting_into_next_tracks_reasons = 15;
    repeated string disallow_inserting_into_context_tracks_reasons = 16;
    repeated string disallow_reordering_in_next_tracks_reasons = 17;
    repeated string disallow_reordering_in_context_tracks_reasons = 18;
    repeated string disallow_removing_from_next_tracks_reasons = 19;
    repeated string disallow_removing_from_context_tracks_reasons = 20;
    repeated string disallow_updating_context_reasons = 21;
    repeated string disallow_playing_reasons = 22;
    repeated string disallow_stopping_reasons = 23;
}

message PlayOrigin {
    string feature_identifier = 1;
    string feature_version = 2;
    string view_uri = 3;
    string external_referrer = 4;
    string referrer_identifier = 5;
    string device_identifier = 6;
    repeated string feature_classes = 7;
}

message ContextPlayerOptions {
    bool shuffling_context = 1;
    bool repeating_context = 2;
    bool repeating_track = 3;
}

message Suppressions {
    repeated string providers = 1;
}

message InstrumentationParams {
    repeated string interaction_ids = 6;
    repeated string page_instance_ids = 7;
}

message Playback {
    int64 timestamp = 1;
    int32 position_as_of_timestamp = 2;
    double playback_speed = 3;
    bool is_paused = 4;
    ContextTrack current_track = 5;
}

message Queue {
    repeated ContextTrack tracks = 1;
    bool is_playing_queue = 2;
}

message Session {
    PlayOrigin play_origin = 1;
    Context context = 2;
    string current_uid = 3;
    ContextPlayerOptionOverrides option_overrides = 4;
    Suppressions suppressions = 5;
    InstrumentationParams instrumentation_params = 6;
}

message TransferState {
    ContextPlayerOptions options = 1;
    Playback playback = 2;
    Session current_session = 3;
    Queue queue = 4;
}

message ContextTrack {
    string uri = 1;
    string uid = 2;
    bytes gid = 3;
    map<string, string> metadata = 4;
}

message ContextPlayerOptionOverrides {
    bool shuffling_context = 1;
    bool repeating_context = 2;
    bool repeating_track = 3;
}

message Context {
    string uri = 1;
    string url = 2;
    map<string, string> metadata = 3;
    Restrictions restrictions = 4;
    repeated ContextPage pages = 5;
    bool loading = 6;
}

message ContextPage {
    string page_url = 1;
    string next_page_url = 2;
    map<string, string> metadata = 3;
    repeated ContextTrack tracks = 4;
    bool loading = 5;
}

message PlayerQueue {
    string revision = 1;
    repeated ProvidedTrack next_tracks = 2;
    repeated ProvidedTrack prev_tracks = 3;
    ProvidedTrack track = 4;
}

message PlaybackQuality {
    BitrateLevel bitrate_level = 1;
    BitrateStrategy strategy = 2;
    BitrateLevel target_bitrate_level = 3;
    bool target_bitrate_available = 4;
    HiFiStatus hifi_status = 5;
}

enum BitrateLevel {
    unknown_bitrate_level = 0;
    low = 1;
    normal = 2;
    high = 3;
    very_high = 4;
    hifi = 5;
}

enum BitrateStrategy {
    unknown_strategy = 0;
    best_matching = 1;
    backend_advised = 2;
    offlined_file = 3;
    cached_file = 4;
    local_file = 5;
}

enum HiFiStatus {
    none = 0;
    off = 1;
    on = 2;
}