import { Component, OnInit } from '@angular/core';
import { ZoneJsonld, ZoneService } from "@app/core/api/v1";
import { AppHelperService } from "@app/_helpers/app-helper.service";
import { ActivatedRoute } from "@angular/router";
import { FormMode } from "@app/_components/_abstract/abstract-data-form-component";

@Component({
    selector: 'app-zone-detail',
    templateUrl: './zone-detail.component.html'
})
export class ZoneDetailComponent implements OnInit {
    protected zone!: ZoneJsonld;
    protected readonly FormMode = FormMode;

    constructor(
        private zoneService: ZoneService,
        protected appHelperService: AppHelperService,
        private route: ActivatedRoute
    ) {}

    ngOnInit() {
        this.route.params.subscribe(params => {
            this.zoneService.zonesIdGet(params['id']).subscribe(
                data => {
                    this.zone = data;
                }
            );
        });
    }
}