selfprivacy.org.app/lib/logic/models/job.dart

76 lines
1.6 KiB
Dart
Raw Normal View History

2021-05-26 00:53:54 +03:00
import 'package:equatable/equatable.dart';
2021-06-08 21:52:44 +03:00
import 'package:flutter/material.dart';
2021-08-18 13:44:46 +03:00
import 'package:selfprivacy/logic/common_enum/common_enum.dart';
2021-08-18 12:36:40 +03:00
import 'package:selfprivacy/utils/password_generator.dart';
2021-08-18 13:44:46 +03:00
import 'package:easy_localization/easy_localization.dart';
2021-05-26 00:53:54 +03:00
2021-08-29 18:02:51 +03:00
import 'user.dart';
2021-06-08 21:52:44 +03:00
@immutable
2021-05-26 00:53:54 +03:00
class Job extends Equatable {
Job({
String? id,
required this.title,
2021-08-18 12:36:40 +03:00
}) : id = id ?? StringGenerators.simpleId();
2021-05-26 00:53:54 +03:00
final String title;
final String id;
@override
List<Object> get props => [id, title];
}
2021-06-08 21:52:44 +03:00
class CreateUserJob extends Job {
CreateUserJob({
required this.user,
2021-08-18 13:44:46 +03:00
}) : super(title: '${"jobs.createUser".tr()} ${user.login}');
2021-06-08 21:52:44 +03:00
final User user;
@override
2021-08-29 18:02:51 +03:00
List<Object> get props => [id, title, user];
2021-06-08 21:52:44 +03:00
}
2021-08-18 13:44:46 +03:00
2021-12-20 17:25:31 +02:00
class DeleteUserJob extends Job {
DeleteUserJob({
required this.user,
}) : super(title: '${"jobs.deleteUser".tr()} ${user.login}');
final User user;
@override
List<Object> get props => [id, title, user];
}
2022-01-25 19:00:47 +02:00
class ToggleJob extends Job {
ToggleJob({
2021-08-18 13:44:46 +03:00
required this.type,
2022-01-25 19:00:47 +02:00
required String title,
}) : super(title: title);
final dynamic type;
@override
List<Object> get props => [...super.props, type];
}
class ServiceToggleJob extends ToggleJob {
ServiceToggleJob({
required ServiceTypes type,
2021-08-18 13:44:46 +03:00
required this.needToTurnOn,
2021-08-29 18:02:51 +03:00
}) : super(
2022-01-25 19:00:47 +02:00
title:
'${needToTurnOn ? "jobs.serviceTurnOn".tr() : "jobs.serviceTurnOff".tr()} ${type.title}',
type: type,
);
2021-08-18 13:44:46 +03:00
final bool needToTurnOn;
}
2021-09-02 22:32:07 +03:00
class CreateSSHKeyJob extends Job {
CreateSSHKeyJob() : super(title: '${"more.create_ssh_key".tr()}');
@override
List<Object> get props => [id, title];
}