//- -var variable = {name: 'SaleOrderDetailRepository', storage: 'SaleOrderDetailStorage', entity: 'SaleOrderDetailEntity',restUri:'a'};

| import { Injectable, Injector } from '@angular/core';
| import { NgRepository } from '@farris/devkit';
| import { BefRepository, NgVariable } from '@farris/bef';
| import { #{variable.externalPrefix}#{variable.entity} } from './entities/#{variable.entity.toLowerCase()}';
if(variable.includeProxyReference)
  | import { #{variable.externalPrefix}#{variable.originalEntity}Proxy } from './#{variable.originalEntity.toLowerCase()}proxy';
|
| @Injectable()
| @NgRepository({
= '\n'
if (variable.restUri)
  |   apiUrl: '#{variable.restUri.toLowerCase()}',
  = '\n'
else
  |   apiUrl: 'api/scm/sd/v1.0/#{variable.entity.toLowerCase().replace("entity","service")}',
  = '\n'
|   entityType: #{variable.externalPrefix}#{variable.entity}
| })
| export class #{variable.externalPrefix}#{variable.name} extends BefRepository<#{variable.externalPrefix}#{variable.entity}> {
= '\n'
| public name= '#{variable.externalPrefix}#{variable.name}';
= '\n'
if(variable.includeProxyReference)
  | public proxy:#{variable.externalPrefix}#{variable.originalEntity}Proxy;
  = '\n'
each state in variable.states
  |   @NgVariable({
  |       mapping: '#{state.code}'
  |   })
  |   public #{state.code}: #{state.type};
  = '\n'
  = '\n'
|  public paginationInfo={
if (variable.paginations)
  each pagination in variable.paginations
    =  '\n'
    |      #{variable.externalPrefix}#{variable.entity}:{
    |          pageSize:#{pagination.pagination.pageSize} ,
    = '\n'
    |        }
    = '\n'
|       };
|   constructor(injector: Injector) {
|     super(injector);
if(variable.includeProxyReference)
  |     this.proxy=injector.get(#{variable.externalPrefix}#{variable.originalEntity}Proxy,null);
|   }
| }
= '\n'
= '\n'