from typing import List
import random


def choose_seq_indices(
    input_seqs: int,
    proportion: float = 1.0,
        max_records: int = 10000) -> List[int]:

    """Generate a list seq indices.
    Args:
        input_seq (int): number of input_sequences
        proportion (float): proportion of seqs to extract
            if not larger than max_records and not larger
            than nr of input sequences
        max_records (int): max_nr of records to extract if
            not larger than the number of input sequences

    Returns:
        list of indices (list(int))
    """

    # default number of sequences to get: entire set
    nr_seqs_to_get = input_seqs

    # should we extract a specified proportion?
    if proportion < 1.0:
        nr_seqs_to_get = int(proportion * input_seqs)
    elif max_records < nr_seqs_to_get:
        # we want a specific number
        # if it's not larger than the number of sequences we have
        nr_seqs_to_get = max_records

    # get a random subset of sequence indices
    # sorted from lowest to highest
    seqs_ids = list(range(input_seqs))
    random.shuffle(seqs_ids)

    # get the indices of sequences to extract, sorted
    seqs_ids = seqs_ids[:nr_seqs_to_get]

    return sorted(seqs_ids)