<?php

namespace AuthStack\SAMLServiceProvider\Provider;

use Illuminate\Support\ServiceProvider;

class SamlServiceProvider extends ServiceProvider
{
    public function boot()
    {
        $this->publishes([
            $this->getSPConfigPath() => config_path('saml/sp.php'),
            $this->getIDPConfigPath() => config_path('saml/idp.php'),
        ], 'samlconfig');

        $this->mergeConfig();
    }

    protected function getSPConfigPath()
    {
        return __DIR__ . '/../../config/saml/sp.php';
    }

    protected function getIDPConfigPath()
    {
        return __DIR__ . '/../../config/saml/idp.php';
    }

    protected function mergeConfig()
    {
        $this->mergeConfigFrom($this->getSPConfigPath(), 'samlconfig');
        $this->mergeConfigFrom($this->getIDPConfigPath(), 'samlconfig');
    }
}