<?php use JetBrains\PhpStorm\NoReturn;

class audiorecordingfile extends audiorecording {
	
	#[NoReturn] public static function getById(int $id): ?array {
		$recording=audiorecording::getById($id);
		$path=rtrim(config::get('core_filestore'),'/').'/files/project'.$recording['projectid'].'/audio/recording'.$id;
		$file=fopen($path,'rb');
		header('Content-Type: audio/webm;codecs=opus');
		fpassthru($file);
		fclose($file);
		exit;
	}
	
	public static function create(array $request=array()): array {
		throw new BadRequestException('Create an audiorecording instead');
	}
	public static function update(int $id,$request=array()): array {
		throw new BadRequestException('Update the audiorecording instead');
	}
	public static function delete(int $id): array {
		throw new BadRequestException('Delete the audiorecording instead');
	}
	
}