import type {
  PAGFile,
} from './types';

const interceptor: any = {
};

function createProxyPAGFile(originPAGFile: PAGFile): any {
  const proxyPAGFile = new Proxy(originPAGFile, {
    get(target, prop, receiver) {
      const value = interceptor[prop];
      if (value instanceof Function) {
        return function (this: any, ...args: any[]) {
          return value.apply(this === receiver ? target : this, args); // 兼容this方式调用
        };
      }

      return Reflect.get(target, prop, receiver);
    },
  });

  return proxyPAGFile;
}

export {
  createProxyPAGFile,
};
