/**
* Copyright 2024 Brendan Robert
*
* 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 jace.hardware.massStorage.core;

import java.io.IOException;

/**
 * Interface for reading blocks from ProDOS storage.
 * Provides abstraction over physical disk access for file storage strategies.
 */
public interface BlockReader {
    /**
     * Reads a single 512-byte block from the disk.
     *
     * @param blockNumber the block number to read (0-based)
     * @return a 512-byte array containing the block data
     * @throws IOException if an I/O error occurs
     * @throws IllegalArgumentException if blockNumber is negative or exceeds disk capacity
     */
    byte[] readBlock(int blockNumber) throws IOException;

    /**
     * Gets the total number of blocks available on this disk.
     *
     * @return the total block count
     */
    int getTotalBlocks();
}
