<?php

declare(strict_types=1);

namespace PhpWA\Media;

use InvalidArgumentException;

final class MediaType
{
    public const IMAGE = 'image';
    public const VIDEO = 'video';
    public const AUDIO = 'audio';
    public const DOCUMENT = 'document';
    public const STICKER = 'sticker';
    public const HISTORY = 'md-msg-hist';
    public const APP_STATE = 'md-app-state';

    public static function hkdfInfo(string $type): string
    {
        $map = [
            self::IMAGE => 'WhatsApp Image Keys', self::STICKER => 'WhatsApp Image Keys',
            self::VIDEO => 'WhatsApp Video Keys', self::AUDIO => 'WhatsApp Audio Keys',
            self::DOCUMENT => 'WhatsApp Document Keys', self::HISTORY => 'WhatsApp History Keys',
            self::APP_STATE => 'WhatsApp App State Keys',
        ];
        if (!isset($map[$type])) { throw new InvalidArgumentException('Unsupported WhatsApp media type.'); }
        return $map[$type];
    }

    public static function mmsPath(string $type): string
    {
        self::hkdfInfo($type);
        $map = [self::IMAGE => 'image', self::STICKER => 'image', self::VIDEO => 'video', self::AUDIO => 'audio',
            self::DOCUMENT => 'document', self::HISTORY => 'md-msg-hist', self::APP_STATE => 'md-app-state'];
        return $map[$type];
    }

    private function __construct() {}
}
