import { BaseSchema } from '@adonisjs/lucid/schema'

export default class InternationalShipmentCarriers extends BaseSchema {
  protected tableName = 'international_shipment_carriers'

  public async up() {
    this.schema.createTable(this.tableName, (table) => {
      table.increments('id')
      table.string('carrier', 50).notNullable().unique()
      table.boolean('is_enabled').notNullable().defaultTo(true)

      // DHL
      table.string('dhl_username').nullable()
      table.string('dhl_password').nullable()
      table.string('dhl_account_number').nullable()

      // Aramex
      table.string('aramex_username').nullable()
      table.string('aramex_password').nullable()
      table.string('aramex_account_number').nullable()
      table.string('aramex_account_pin').nullable()
      table.string('aramex_entity').nullable()
      table.string('aramex_country_code').nullable()

      // SMSA
      table.string('smsa_passkey').nullable()
      table.string('smsa_soap_passkey').nullable()

      // FedEx
      table.string('fedex_api_key').nullable()
      table.string('fedex_secret_key').nullable()
      table.string('fedex_account_number').nullable()

      table.timestamp('created_at').notNullable()
      table.timestamp('updated_at').nullable()
    })
  }

  public async down() {
    this.schema.dropTable(this.tableName)
  }
}
