package agent

import (
	"context"

	rmodel "git-molva.ru/Molva/molva-backend/services/api_gateway/internal/request_model"
)

type AgentService interface {
	GetVacancyList(ctx context.Context, request *rmodel.VacancyListGetRequest) (*rmodel.VacancyListGetResponse, error)

	GetSubmissionList(ctx context.Context, request *rmodel.SubmissionListGetRequest) (*rmodel.SubmissionListGetResponse, error)
	CreateSubmission(ctx context.Context, request *rmodel.SubmissionCreateRequest) (*rmodel.SubmissionCreateResponse, error)
	DeleteSubmission(ctx context.Context, request *rmodel.SubmissionDeleteRequest) (*rmodel.SubmissionDeleteResponse, error)

	GetProfile(ctx context.Context, request *rmodel.ProfileGetRequest) (*rmodel.ProfileGetResponse, error)
	UpdateProfile(ctx context.Context, request *rmodel.ProfileUpdateRequest) (*rmodel.ProfileUpdateResponse, error)

	GetCompanyList(ctx context.Context, request *rmodel.CompanyListGetRequest) (*rmodel.CompanyListGetResponse, error)
	GetCompanyInfo(ctx context.Context, request *rmodel.CompanyByIdGetRequest) (*rmodel.CompanyByIdGetResponse, error)
	CreateCompany(ctx context.Context, request *rmodel.CompanyCreateRequest) (*rmodel.CompanyCreateResponse, error)
	UpdateCompanyInfo(ctx context.Context, request *rmodel.CompanyUpdateRequest) (*rmodel.CompanyUpdateResponse, error)

	GetBalance(ctx context.Context, request *rmodel.BalanceGetRequest) (*rmodel.BalanceGetResponse, error)

	GetTransactionList(ctx context.Context, request *rmodel.TransactionListGetRequest) (*rmodel.TransactionListGetResponse, error)
	CreateTransaction(ctx context.Context, request *rmodel.TransactionCreateRequest) (*rmodel.TransactionCreateResponse, error)

	GetBankAccountList(ctx context.Context, request *rmodel.BankAccountListGetRequest) (*rmodel.BankAccountListGetResponse, error)
	CreateBankAccount(ctx context.Context, request *rmodel.BankAccountCreateRequest) (*rmodel.BankAccountCreateResponse, error)
	UpdateBankAccount(ctx context.Context, request *rmodel.BankAccountUpdateRequest) (*rmodel.BankAccountUpdateResponse, error)
	DeleteBankAccount(ctx context.Context, request *rmodel.BankAccountDeleteRequest) (*rmodel.BankAccountDeleteResponse, error)
}

func New(typ Type, cfg Config) (AgentService, error) {
	switch typ {
	case CrmAgentServiceType:
		config, ok := cfg.(CrmAgentServiceConfig)
		if !ok {
			return nil, ErrInvalidConfig
		}

		return newCrmAgentService(config), nil

	default:
		return nil, ErrUnknownAgentServiceType
	}
}
