---
# System prepended metadata

title: Untitled

---

```
-TODO
  - A. sender - minimum keystroke
  - B. to 
  - C. cc
  - D. bcc
  - E. reply to
  - bcc
  - content
    - text only
    - html
    - template with params

class Email {
  sender: Email.Contact
  recipients: Recipients
  replyTo?: Email.Contact
  emailContent: Email.Content
  
    interface Recipients {
      to: EmailContact
      bcc?: EmailContact[]
      cc?: EmailContact[]
    }

    interface Content {
      subject: string
      content: string
      attachment?: any
    }

    class Contact {
      name?: string
      emailAddress: string
      
      constructor(emailAddress: string, name) { 
        validate_email_length_less_160_char(emaillAddress)
        validate_name_strange_char(name)
      }
    }
}

User {
    name: "ming"
    phone: 1233445
    
    
}

UserShippingPreference {
  name: string
  
}


AddressDbModel {
  "address": "sg"
}

ShippingAddress {
  AddressDbModel
}

AddressCompliainceVerification {
  AddressDbModel "hk???" "sg!"
  
  
}


Card {

   cardholderlatestaddress: ""
}


v DOMAIN!!!! -> how to persist
X persist --> domain


new UserShippingPreference(user_id: "mingabc", name: "Preferred", address: "sgfdsaf dfdsafdsafdafdaa fda fdsa")
new UserShippingPreference(user_id: "mingabc", name: "wife", address: "", )

Shipping { 
  tracknumber
  recipient: RecipientContact
  state: return? shipped?
  
  RecipientContact {
    name: "bonnie"
    email: "bonnie"
    phone: "bonnie number"
    address: "hkfdsaf da fda fdsa"
    
  }
}

User {
  current_sign_in_at
    authentication
    sms / email confirmation
    acquisition
    onboarding
    payment preference
    
}

ContactRepository: Repository<ContactDomainModel> {
  get_by_user_id(user_id: int / string) {
    db_query = "select email, phone from user where user_id = #{user_id}"
    result = database.run(db_query)
    return new ContactComainModel(result["email"], result["phone"])
  }
  update_by
  delete
}

UserDbModel <---> Contact

ContactDomainModel {
  primaryContact: EmailContact
  phone?: Phone
  address?: Address
}

UsAddressDomainModel {
  state: USState,
  postalCode: UsPostalCode
}

GenericAddressDomainModel {
  postalcode?: ""
}

AddressDbmodel {
    postal: string
    address_1: string
    address_2: string
}

Phone {
  number: string
}

interface EmailTemplate {
  content: string
  parameter: Object
  getTemplateContent(): string
}
let sender: EmailAddress = { address: 'brian@crypto.com', type: EmailAddressType.From }
let receiver: EmailAddress = { address: 'ming@crypto.com', type: EmailAddressType.To }
let receiver2: EmailAddress = { address: 'kris@crypto.com', type: EmailAddressType.Cc }
let email: Email = { contacts: [sender, receiver, receiver2], subject: 'Test email', content: 'Test content' }
interface SendGridEmail {
  from: string
  reply_to?: string
  to: string
  bcc?: string
  cc?: string
  subject: string
  content: string
  attachment?: any
  emailSignature?: any
}
interface SendGridEmailAdapter {
  email: Email
  getSendGridFormat: (Email) => SendGridEmail
}
let sendGridEmail: SendGridEmailAdapter = { email }
sendGridEmail.getSendGridFormat(email)
```