import { BUNNY_NET_BASE_URL, BUNNY_NET_ENDPOINTS, BunnyNetConfig } from '../types/BunnyNetTypes';
import { ExtendedDRMConfig } from '../types/DRMTypes';

export class BunnyNetProvider {
  static createConfig(bunnyConfig: BunnyNetConfig): ExtendedDRMConfig {
    const base = `${BUNNY_NET_BASE_URL}/${bunnyConfig.libraryId}/${bunnyConfig.videoId}`;
    return {
      type: 'fairplay',
      licenseUrl: `${base}${BUNNY_NET_ENDPOINTS.license}`,
      certificateUrl: `${base}${BUNNY_NET_ENDPOINTS.certificate}`,
      headers: bunnyConfig.token ? { 'AccessKey': bunnyConfig.token } : undefined,
    };
  }
}
