/*
 * Copyright 2018 The twicalico authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.github.moko256.mastodon;

import com.sys1yagi.mastodon4j.api.Pageable;

import java.util.ArrayList;

import twitter4j.RateLimitStatus;
import twitter4j.ResponseList;
import twitter4j.Status;

/**
 * Created by moko256 on 2017/10/04.
 *
 * @author moko256
 */

public class MTResponseList<T> extends ArrayList<T> implements ResponseList<T> {

    MTResponseList(){
        super();
    }

    public static ResponseList<Status> convert(Pageable<com.sys1yagi.mastodon4j.api.entity.Status> statusPageable){
        ResponseList<Status> responseList = new MTResponseList<>();
        for (com.sys1yagi.mastodon4j.api.entity.Status status : statusPageable.getPart()) {
            responseList.add(new MTStatus(status));
        }
        return responseList;
    }

    @Override
    public RateLimitStatus getRateLimitStatus() {
        return null;
    }

    @Override
    public int getAccessLevel() {
        return 0;
    }

}

@@ -710,16 +710,39 @@
 rayList;
+%0Aimport java.util.List;
 %0A%0Aimport
@@ -1016,24 +1016,81 @@
 per();%0A    %7D
+%0A    MTResponseList(int size)%7B%0A        super(size);%0A    %7D
 %0A%0A    public
@@ -1191,24 +1191,113 @@
 sPageable)%7B%0A
+        List%3Ccom.sys1yagi.mastodon4j.api.entity.Status%3E part = statusPageable.getPart();%0A
         Resp
@@ -1349,16 +1349,27 @@
 eList%3C%3E(
+part.size()
 );%0A     
@@ -1431,32 +1431,12 @@
 s : 
-statusPageable.getP
+p
 art
-()
 ) %7B%0A

add init count