// Path: components/billing/src/main/java/com/example/billing/BillingRequest.java
// public class BillingRequest {
//     private final String userId;
//     private final int amount;
// 
//     public BillingRequest(String userId, int amount) {
//         this.userId = userId;
//         this.amount = amount;
//     }
// 
//     public String getUserId() {
//         return userId;
//     }
// 
//     public int getAmount() {
//         return amount;
//     }
// }
// 
// Path: components/email/src/main/java/com/example/email/EmailMessage.java
// public class EmailMessage implements Serializable {
// 
//     private final String toAddress;
//     private final String subject;
//     private final String body;
// 
//     public EmailMessage(String toAddress, String subject, String body) {
// 
//         this.toAddress = toAddress;
//         this.subject = subject;
//         this.body = body;
//     }
// 
//     public String getToAddress() {
//         return toAddress;
//     }
// 
//     public String getSubject() {
//         return subject;
//     }
// 
//     public String getBody() {
//         return body;
//     }
// }
// 
// Path: components/email/src/main/java/com/example/email/SendEmail.java
// public class SendEmail {
//     private final String queueName;
//     private final RabbitTemplate rabbitTemplate;
// 
//     public SendEmail(String queueName, RabbitTemplate rabbitTemplate) {
//         this.queueName = queueName;
//         this.rabbitTemplate = rabbitTemplate;
//     }
// 
//     public void run(EmailMessage message) {
//         rabbitTemplate.convertAndSend(queueName, message);
//     }
// }


import com.example.billing.BillingRequest;
import com.example.billing.Service;
import com.example.email.EmailMessage;
import com.example.email.SendEmail;
package com.example.subscriptions;


public class CreateSubscription {

    private final Service billingService;
    private final SendEmail emailSender;
    private final SubscriptionRepository subscriptions;

    public CreateSubscription(
            Service billingService,
            SendEmail emailSender, SubscriptionRepository subscriptions) {
        this.billingService = billingService;
        this.emailSender = emailSender;
        this.subscriptions = subscriptions;
    }

    public void run(String userId, String packageId) {
// Path: components/billing/src/main/java/com/example/billing/BillingRequest.java
// public class BillingRequest {
//     private final String userId;
//     private final int amount;
// 
//     public BillingRequest(String userId, int amount) {
//         this.userId = userId;
//         this.amount = amount;
//     }
// 
//     public String getUserId() {
//         return userId;
//     }
// 
//     public int getAmount() {
//         return amount;
//     }
// }
// 
// Path: components/email/src/main/java/com/example/email/EmailMessage.java
// public class EmailMessage implements Serializable {
// 
//     private final String toAddress;
//     private final String subject;
//     private final String body;
// 
//     public EmailMessage(String toAddress, String subject, String body) {
// 
//         this.toAddress = toAddress;
//         this.subject = subject;
//         this.body = body;
//     }
// 
//     public String getToAddress() {
//         return toAddress;
//     }
// 
//     public String getSubject() {
//         return subject;
//     }
// 
//     public String getBody() {
//         return body;
//     }
// }
// 
// Path: components/email/src/main/java/com/example/email/SendEmail.java
// public class SendEmail {
//     private final String queueName;
//     private final RabbitTemplate rabbitTemplate;
// 
//     public SendEmail(String queueName, RabbitTemplate rabbitTemplate) {
//         this.queueName = queueName;
//         this.rabbitTemplate = rabbitTemplate;
//     }
// 
//     public void run(EmailMessage message) {
//         rabbitTemplate.convertAndSend(queueName, message);
//     }
// }


// Path: components/subscriptions/src/main/java/com/example/subscriptions/CreateSubscription.java
import com.example.billing.BillingRequest;
import com.example.billing.Service;
import com.example.email.EmailMessage;
import com.example.email.SendEmail;

package com.example.subscriptions;


public class CreateSubscription {

    private final Service billingService;
    private final SendEmail emailSender;
    private final SubscriptionRepository subscriptions;

    public CreateSubscription(
            Service billingService,
            SendEmail emailSender, SubscriptionRepository subscriptions) {
        this.billingService = billingService;
        this.emailSender = emailSender;
        this.subscriptions = subscriptions;
    }

    public void run(String userId, String packageId) {
        subscriptions.create(new Subscription(userId, packageId));