import type { ApplicationContract } from '@ioc:Adonis/Core/Application';
import Hash from '@ioc:Adonis/Core/Hash';
import { LaravelHash } from './HashDriver';

export default class AppProvider {
    constructor(protected app: ApplicationContract) {}

    public register() {
        // Register your own bindings
    }

    public async boot() {
        // IoC container is ready
        const hashInstance: typeof Hash = this.app.container.use('Adonis/Core/Hash');
        hashInstance.extend('bcrypt', () => {
            return new LaravelHash();
        });
    }

    public async ready() {
        // App is ready
    }

    public async shutdown() {
        // Cleanup, since app is going down
    }
}
