<?php

namespace Kylin\Community;

use Illuminate\Support\ServiceProvider;

/**
 * 智慧社区服务提供者
 *
 * 依据《智慧社区建设指南》(建办科〔2014〕34号)，
 * 提供居民信息管理、房屋管理、报修服务、投诉建议、
 * 社区活动、邻里互助、物业缴费、公告通知等核心功能。
 */
class CommunityServiceProvider extends ServiceProvider
{
    public function register(): void
    {
        $this->mergeConfigFrom(
            __DIR__.'/../config/kylin-community.php', 'kylin-community'
        );
    }

    public function boot(): void
    {
        if ($this->app->runningInConsole()) {
            $this->publishes([
                __DIR__.'/../config/kylin-community.php' => config_path('kylin-community.php'),
            ], 'kylin-community-config');

            $this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
        }

        $this->loadRoutesFrom(__DIR__ . '/../routes/api.php');
    }
}
