package com.saas.shared.dto.mapper;

import com.saas.admin.dto.response.RoleResponse;
import com.saas.admin.entity.Role;
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 RoleMapperImpl implements RoleMapper {

    @Override
    public RoleResponse toResponse(Role role) {
        if ( role == null ) {
            return null;
        }

        RoleResponse.RoleResponseBuilder roleResponse = RoleResponse.builder();

        roleResponse.permissions( extractPermissions( role ) );
        roleResponse.id( role.getId() );
        roleResponse.name( role.getName() );
        roleResponse.description( role.getDescription() );
        roleResponse.isActive( role.getIsActive() );
        roleResponse.isSystem( role.getIsSystem() );
        roleResponse.createdAt( role.getCreatedAt() );
        roleResponse.updatedAt( role.getUpdatedAt() );

        return roleResponse.build();
    }

    @Override
    public List<RoleResponse> toResponseList(List<Role> roles) {
        if ( roles == null ) {
            return null;
        }

        List<RoleResponse> list = new ArrayList<RoleResponse>( roles.size() );
        for ( Role role : roles ) {
            list.add( toResponse( role ) );
        }

        return list;
    }
}
