import { Request, Response, NextFunction } from 'express';
import { GetAddressByAddressUseCase } from '../../application/use-cases/address/get-address-by-address.use-case';

export class AddressController {
  constructor(private readonly getAddressByAddressUseCase: GetAddressByAddressUseCase) {}

  getByAddress = async (req: Request, res: Response, next: NextFunction): Promise<void> => {
    try {
      const address = await this.getAddressByAddressUseCase.execute(req.params.address as string);
      res.status(200).json({ success: true, data: address });
    } catch (error) {
      next(error);
    }
  };
}
