package com.saas.shared.dto.mapper;

import com.saas.admin.dto.request.CreateTenantRequest;
import com.saas.admin.dto.response.TenantResponse;
import com.saas.admin.entity.Tenant;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.processing.Generated;
import org.springframework.stereotype.Component;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2025-10-22T21:40:37+0100",
    comments = "version: 1.6.3, compiler: javac, environment: Java 25 (Homebrew)"
)
@Component
public class TenantMapperImpl implements TenantMapper {

    @Override
    public TenantResponse toResponse(Tenant tenant) {
        if ( tenant == null ) {
            return null;
        }

        TenantResponse.TenantResponseBuilder tenantResponse = TenantResponse.builder();

        tenantResponse.tenantId( tenant.getTenantId() );
        tenantResponse.tenantName( tenant.getTenantName() );
        tenantResponse.schemaName( tenant.getSchemaName() );
        tenantResponse.status( tenant.getStatus() );
        tenantResponse.createdAt( tenant.getCreatedAt() );
        tenantResponse.updatedAt( tenant.getUpdatedAt() );

        return tenantResponse.build();
    }

    @Override
    public List<TenantResponse> toResponseList(List<Tenant> tenants) {
        if ( tenants == null ) {
            return null;
        }

        List<TenantResponse> list = new ArrayList<TenantResponse>( tenants.size() );
        for ( Tenant tenant : tenants ) {
            list.add( toResponse( tenant ) );
        }

        return list;
    }

    @Override
    public Tenant toEntity(CreateTenantRequest request) {
        if ( request == null ) {
            return null;
        }

        Tenant tenant = new Tenant();

        tenant.setTenantName( request.getTenantName() );
        tenant.setStatus( request.getStatus() );

        return tenant;
    }
}
