/*
 * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com).
 *
 * WSO2 LLC. licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.wso2.carbon.is.migration.service.v700.migrator;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wso2.carbon.identity.core.migrate.MigrationClientException;
import org.wso2.carbon.is.migration.service.Migrator;
import org.wso2.carbon.is.migration.service.v700.service.FederateSessionMappingService;
import org.wso2.carbon.is.migration.util.Constant;
import org.wso2.carbon.is.migration.util.ReportUtil;

import java.util.Properties;

import static org.wso2.carbon.is.migration.util.Constant.REPORT_PATH;

/**
 * Migrator for adding idp id for existing federated session mappings.
 */
public class FederateSessionMappingMigrator extends Migrator {

    private static final Logger LOG = LoggerFactory.getLogger(FederateSessionMappingMigrator.class);
    private static final FederateSessionMappingService federateSessionMappingService
            = new FederateSessionMappingService();

    @Override
    public void dryRun() throws MigrationClientException {

        LOG.info(Constant.MIGRATION_LOG + "Dry run capability not implemented in {} migrator.",
                this.getClass().getName());
    }

    @Override
    public void migrate() throws MigrationClientException {

        LOG.info(Constant.MIGRATION_LOG + "Starting migrator run for {}", this.getClass().getName());
        federateSessionMappingService.execute();
        LOG.info(Constant.MIGRATION_LOG + "Ending migrator run for {}", this.getClass().getName());
    }
}
