import { Component } from '@angular/core';
import { IObjectController } from '@objects-view/interfaces/object-controller';
import { StaticObjectController } from '@objects-view/static-object-controller';
import { AddCreditFormComponent } from '../tabs/add-credit-form/add-credit-form.component';
import { ActivatedRoute, Router } from '@angular/router';
import { RouterLinkAction } from '@objects-view/actions/router-link-action';
import { ConfigService } from '@shared/config/config.service';
import { CallbackAction } from '@objects-view/actions/callback-action';

@Component({
  selector: 'app-add-credit',
  templateUrl: './add-credit.component.html',
  styleUrls: ['./add-credit.component.scss']
})
export class AddCreditComponent {
  public objectController: IObjectController = new StaticObjectController(
    {
      header: {
        title: {
          text: $localize`Add credit`,
        }
      },
      tabs: [{
        tabName: $localize`Overview`,
        tabIdentifier: 'overview',
        component: AddCreditFormComponent,
      }],
      detailsActions: [
        new RouterLinkAction({
            name: $localize`Cancel`,
            routerUrl: this.config.getPanelHomeUrl(),
            router: this.router,
          }
        ),
        new CallbackAction({
          name: $localize`Add credit`,
          internalName: 'addCredit'
        })
      ]
    },
    this.activatedRoute.snapshot.data.client,
  );

  constructor(
    private activatedRoute: ActivatedRoute,
    private router: Router,
    private config: ConfigService,
  ) {
  }
}
