/**
 * @aurora-catalyst-generated
 * @source cliter/o-auth/scope.aurora.yaml
 */
import { Auditable } from '@aurorajs.dev/core-back';
import { DataTypes } from 'sequelize';
import { Column, Model, Table } from 'sequelize-typescript';

@Auditable()
@Table({
  modelName: 'OAuthScope',
  tableName: 'o_auth_scope',
  freezeTableName: true,
  timestamps: false,
  indexes: [
    {
      fields: ['row_id'],
      unique: true,
    },
    {
      fields: ['code'],
      unique: true,
    },
  ],
})
export class OAuthScopeModel extends Model<OAuthScopeModel> {
  @Column({
    field: 'id',
    primaryKey: true,
    allowNull: false,
    type: DataTypes.UUID,
  })
  id: string;

  @Column({
    field: 'row_id',
    autoIncrement: true,
    allowNull: false,
    type: DataTypes.BIGINT,
  })
  rowId: number;

  @Column({
    field: 'code',
    allowNull: false,
    type: DataTypes.STRING(64),
  })
  code: string;

  @Column({
    field: 'name',
    allowNull: false,
    type: DataTypes.STRING(128),
  })
  name: string;

  @Column({
    field: 'role_ids',
    allowNull: true,
    type: DataTypes.ARRAY(DataTypes.UUID),
  })
  roleIds: string[];

  @Column({
    field: 'created_at',
    allowNull: true,
    type: DataTypes.DATE,
  })
  createdAt: string;

  @Column({
    field: 'updated_at',
    allowNull: true,
    type: DataTypes.DATE,
  })
  updatedAt: string;

  @Column({
    field: 'deleted_at',
    allowNull: true,
    type: DataTypes.DATE,
  })
  deletedAt: string;
}
