import { Component, OnInit } from '@angular/core';
import { VesselJsonld, VesselService } 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-vessel-detail',
    templateUrl: './vessel-detail.component.html'
})
export class VesselDetailComponent implements OnInit {
    protected vessel!: VesselJsonld;
    protected readonly FormMode = FormMode;

    constructor(
        private vesselService: VesselService,
        protected appHelperService: AppHelperService,
        private route: ActivatedRoute
    ) {}

    ngOnInit() {
        this.route.params.subscribe(params => {
            this.vesselService.vesselsIdGet(params['id']).subscribe(
                data => {
                    this.vessel = data;
                }
            );
        });
    }
}