import { AbstractSite, FlashMessenger, InitPromise } from './pwa-lib.js';
import { Form } from './pwa-core.js';

class ContactSite extends AbstractSite{
    constructor(siteManager) {
        super(siteManager, 'contact/html/contact.html', ContactSite.DEEP_LINK);
    }

    onFirstStart() {
        new Form(this.findBy("#contact-form"), "contact", "post").onSubmit((d) => {
            FlashMessenger.addMessage("contact-message-sent");
            this.finish();
        });

        super.onFirstStart();
    }
}
ContactSite.DEEP_LINK = "contactMe";

InitPromise.addPromise((app) => {
    if (ContactSite.DEEP_LINK){
        app.addDeepLink(ContactSite.DEEP_LINK, ContactSite);
    }
});

export { ContactSite };
