package ru.somecompany.mapper;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import ru.somecompany.domain.CompanyResponse;
import ru.somecompany.domain.CreateVacancyRequest;
import ru.somecompany.domain.VacancyEntity;
import ru.somecompany.domain.VacancyResponse;

import java.util.UUID;

@Mapper(imports = UUID.class)
public interface VacancyMapper {

    @Mapping(target = "company", source = "company")
    @Mapping(target = "name", source = "entity.name")
    @Mapping(target = "id", source = "entity.id")
    VacancyResponse map(VacancyEntity entity, CompanyResponse company);

    VacancyEntity map(CreateVacancyRequest request);

    VacancyEntity map(@MappingTarget VacancyEntity entity, CreateVacancyRequest request);
}
