export function parseAction(fix: Fix): string {
  return `${fix.domain}##${fix.selector}##${fix.name}${fix.property ? `##${fix.property}` : ''}`;
}

export function toDeclarativeNetRequestRule(urlFilter: string, index: number) {
  return {
    action: {
      type: 'block',
    },
    condition: {
      resourceTypes: ['font', 'image', 'media', 'object', 'script', 'stylesheet', 'xmlhttprequest'],
      urlFilter,
    },
    id: index + 1,
    priority: 1,
  };
}

export interface Fix {
  readonly domain: string;
  readonly name: string;
  readonly property?: string;
  readonly selector: string;
}
