<?php

/*
 * This file is part of the AuthStack project.
 *
 * (c) Buckhill Ltd <development@buckhill.co.uk>
 *
 * This source file is subject to the Buckhill license that is bundled
 * with this source code in the file LICENSE.
 */

namespace AuthStack\TwoFactor\Collection;

use AuthStack\TwoFactor\Model\MFAKey;

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 MFAKey $key
     *
     * @return KeyCollectionInterface
     */
    public function add(MFAKey $key);


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


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


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

    /**
     * For each U2F key, create authentication challenge and return an array containing challenge(s)
     *
     * @return array
     */
    public function U2FAuthChallenge();

    /**
     * @param $otp
     * @return MFAKey
     */
    public function verifyOTP($otp);


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


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


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


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

}