const HttpException = require('../../../utils/HttpException.js');

exports.validateStoreCityRequest = (body) => {
    const { name, province_id } = body;

    const errors = {};

    if (!name || name.trim() === '') {
        errors.name = ['City name is required'];
    }

    if (!province_id || province_id.trim() === '') {
        errors.province_id = ['Province ID is required'];
    }

    if (Object.keys(errors).length > 0) {
        throw new HttpException(errors, 422);
    }

    return {
        name: name.trim(),
        province_id: province_id.trim()
    };
};