<?php

namespace AuthStack\TwoFactor\Collection;

use AuthStack\TwoFactor\Model\KeyInterface;

interface KeyCollectionInterface
{
    const TYPE_OTP = 'otp';
    const TYPE_U2F = 'u2f';

    /**
     * @return int
     */
    public function size();


    /**
     * @param $what
     * @return int
     */
    public function count($what);


    /**
     * @param $type
     * @return array
     */
    public function filter($type);


    /**
     * @param KeyInterface $key
     *
     * @return KeyCollectionInterface
     */
    public function add(KeyInterface $key);


    /**
     * @return array
     */
    public function getU2FKeyIds();


    /**
     * @return array
     */
    public function getOTPKeyIds();


    /**
     * @return bool
     */
    public function hasU2F();


    /**
     * @param $id
     * @return bool
     */
    public function has($id);


    /**
     * @param $id
     *
     * @return KeyInterface
     */
    public function getById($id);


    /**
     * @return array
     */
    public function all();


    /**
     * @return array
     */
    public function toArray();

}