import { Component, OnInit } from '@angular/core';
import { ModalDialogParams } from '@nativescript/angular';
import { CampParticipant } from '~/pages/event/types/camp';

@Component({
    selector: 'CampEventParticipantUpdateModalComponent',
    moduleId: module.id,
    templateUrl: './camp-event-participant-update-modal.component.html',
})
export class CampEventParticipantUpdateModalComponent implements OnInit {
    updateModel: { Real?: boolean; Note?: string; Estimate?: boolean; Days?: number; };

    constructor(
        private params: ModalDialogParams,
    ) {
    }
    participantName: string;

    ngOnInit(): void {
        const { Real, Note, Estimate, Days, Name } = this.params.context as CampParticipant;
        this.updateModel = { Real, Note, Estimate, Days }
        this.participantName = Name

    }
    close() {
        this.params.closeCallback();
    }

    submit() {
        const { } = this.updateModel
        this.params.closeCallback({
            ...this.params.context,
            ...this.updateModel,
        });
    }
}